问题
Running the following query in SQL Server Management Studio gives the error below.
update table_name set is_active = 0 where id = 3
A severe error occurred on the current command. The results, if any, should be discarded.
- The logs have been truncated
- there is an update trigger but this isnt the issue
- the transaction count is zero (@@trancount)
I have tried the same update statement on a couple of other tables in the database and they work fine.
DBCC CHECKTABLE('table_name');
gives
DBCC results for 'table_name'.
There are 13 rows in 1 pages for object "table_name".
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
回答1:
I just had the same error, and it was down to a corrupted index. Re-indexing the table fixed the problem.
回答2:
In my case,I was using SubQuery and had a same problem. I realized that the problem is from memory leakage.
Restarting MSSQL service cause to flush tempDb resource and free huge amount of memory.
so this was solve the problem.
回答3:
There are 3 possibilities on the MS KB
- 959028
- 910416
- 938102
When I see stuff like this: I always think hotfix, engine, server errors etc.
4 results: search for ""Msg 0, Level 11,State 0, Line 0" A severe error occurred on the current command"
Edit: It's on MS Connect too
回答4:
Run DBCC CHECKTABLE('table_name');
Check the LOG folder where the isntance is installed (\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG usually) for any file named 'SQLDUMP*'
回答5:
A different scenario but the same error: I got this error when I was trying to insert records into a temporary table using a stored procedure. It turned out there was a parameter mismatch. I was trying to insert a BIGINT into an INT.
Credit goes to Vicky Harp: http://vickyharp.com/2012/03/troubleshooting-a-severe-error-occurred-on-the-current-command/
回答6:
In my case, I was using System.Threading.CancellationTokenSource to cancel a SqlCommand but not handling the exception with catch (SqlException) { }
回答7:
This error is exactly what it means: Something bad happened, that would not normally happen.
In my most recent case, the REAL error was:
Msg 9002, Level 17, State 2, Procedure MyProcedure, Line 2 [Batch Start Line 3]
The transaction log for database 'MyDb' is full due to 'LOG_BACKUP'.
Here is my checklist of things to try, perhaps in this exact order:
- Check if you're out of disk space (this was my real problem; our NOC did not catch this)
- Check if you're low on memory
- Check if the Windows Event Log shows any serious system failures like hard drives failing
- Check if you have any unsafe code loaded through extended procedures or SQLCLR unsafe assemblies that could de-stabilize the SQLServer.exe process.
- Run CheckDB to see if your database has any corruption issues. On a very large database, if this stored procedure only touches a sub-set of tables, you can save time by seeing which partitions (filegroups) the stored procedure touches, and only checking those specific filegroups.
- I would do this for your database and master db as well.
回答8:
This seems to happen when there's a generic problem with your data source that it isn't handling.
In my case I had inserted a bunch of data, the indexes had become corrupt on the table, they needed rebuilding. I found a script to rebuild them all, seemed to fix it. To find the error I ran the same query on the database - one that had worked 100+ times previously.
来源:https://stackoverflow.com/questions/1175244/sql-server-error-on-update-command-a-severe-error-occurred-on-the-current-com