SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


A severe error occurred on the current command.The results, if any, should be discarded.


A severe error occurred on the current command.The results, if any, should be discarded.

Author
Message
kundan.krishna
kundan.krishna
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 0
Guys, I guess there are several reasons which can cause this error. In my case it happend because i was starting transaction and without commiting, my SP was returing. When I commit before return statement it solved my issue. Probably these are unwanted execution flow which if some one follow then we will end-up with such generic error.
kundan.krishna
kundan.krishna
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 0
Guys, I guess there are several reasons which can cause this error. In my case it happend because i was starting transaction and without commiting, my SP was returing. When I commit before return statement it solved my issue. Probably these are unwanted execution flow which if some one follow then we will end-up with such generic error.
James Goodwin
James Goodwin
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1417 Visits: 1107
I just encountered this error.

The steps were

Begin Tran
TRUNCATE Table1

INSERT INTO Table1(Columns...)
SELECT Columns From Table1Backup


This would give the error at the INSERT statement

Changing the Truncate Table to DELETE FROM Table1 allowed the process to work. I would guess that the way Truncate works is preventing inserting into the table (due to locking?) until the Truncate has been committed.

Perhaps other situations are similar with an attempt to update or insert into a table that is locked within the transaction.
--
JimFive
anjaliv
anjaliv
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 Visits: 75
I get the same error when run the following query:

FETCH name_cur INTO @dbName, @tableName
WHILE @@Fetch_Status = 0
BEGIN
SET @sql -....
insert into [dbo].[Table1] (obj_name, obj_type)
EXEC (@sql)
UPDATE [dbo].[Table1] SET db_name = @dbName ,table_name = @tableName WHERE db_name IS NULL
FETCH name_cur INTO @dbName, @tableName
END
CLOSE name_cur
DEALLOCATE name_cur

Can anybody help, why the error comes in the above query?
James Goodwin
James Goodwin
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1417 Visits: 1107
This is a guess based on the Truncate example.

Your Cursor is based on the same table that is being updated in the INSERT and Update statements. The Cursor is holding a lock on that table. Try Declaring your Cursor as READ_ONLY.

Also, instead of:
INSERT INTO Table1(obj_name, Obj_type)
EXEC (@SQL)

UPDATE Table1 Set ...

You could put the @dbName and @tableName in the SQL Statement and do it as one statement.

Even Better: Find a way to do this without a cursor. There doesn't seem to be anything in there that requires working on one row at a time.
--
JimFive
anjaliv
anjaliv
Valued Member
Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)Valued Member (51 reputation)

Group: General Forum Members
Points: 51 Visits: 75
Thank you James.
But my cursor depends on different table suppose (main_table). and I want to find dependency of table read from main_table. And I am storing it into another table. I will try to do UPDATE in one statement and making cursor READ_ONLY. But i do not think its because of the lock on cursor.
aleksey.fomchenko
aleksey.fomchenko
SSC-Enthusiastic
SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)

Group: General Forum Members
Points: 112 Visits: 496
Hi there,

I have seen the same issue on my production box.
The problems looks like SQL Server works incorrectly with several sub-queries using <> on NOT IN expressions.
There is a workaround. You can use JOINs instead of sub-queries in order to overcome this issue.
Maria Claudia Sanchez
Maria Claudia Sanchez
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 50
I have the same error:
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.

When I execute:

select top 10 * from sysindexes

I have SQL SERVER 2005 service pack 4
Any idea???
GilaMonster
GilaMonster
SSC Guru
SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)SSC Guru (86K reputation)

Group: General Forum Members
Points: 86977 Visits: 45267
Please run the following and post the full and complete results


DBCC CHECKDB (<Database Name>Wink WITH NO_INFOMSGS, ALL_ERRORMSGS



Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Maria Claudia Sanchez
Maria Claudia Sanchez
Grasshopper
Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)Grasshopper (17 reputation)

Group: General Forum Members
Points: 17 Visits: 50
The result of
DBCC CHECKDB ('DatabaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS

is:
Command(s) completed successfully.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search