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

  • Hi all, i have some problem with my SQL Server, if i am creating any new Db, and i am accessing through my .NET Application, that time its giving error like that, but if i am Executing any query from my Managememnt Studio then its working fine, but while my Asp.net page its giving Error Like that

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

    Plz, check this problem and let me know.

    Thanks

  • >> i am accessing through my .NET Application, that time its giving error like that, but if i am Executing any query from my Managememnt Studio then its working fine, but while my Asp.net page its giving Error

    Are you using stored procedure? If NO, create a stored procedure and call it from your .NET application. It may work.

  • There is a Hotfix available on microsoft site.

    Pl refer http://support.microsoft.com/kb/910416

  • Was getting error "Msg 0, Level 11, State 0, Line 0

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

    Changed my delete query to delete based on primary key

    "delete from table where pk in (select pk from table where num=5)"

    for whatever reason "delete from table where num=5" was giving severe error

  • Might be a recursion problem with the sub-query.

    I have to ask, why the sub-query at all, or are these two different tables?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Just in case, run the following and check that it doesn't return anything.

    DBCC CHECKDB (<Database Name>) 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
  • I too am facing 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.

    This is occurring while running the below script.

    update <tab_name> set code = 'CANCELLED' where nbr = 'A325'

    Unable to figure out whether this is due to dependency to this table or some other issue. The server timeout value is set as: 10 mins which is quite good.

    Any suggestion would be highly helpful.

    Thanks.

  • Any suggestion please??

    Thanks.

  • Can anyone please recommend further?

    Thanks.

  • I recently ran across this issue in one of my data conversions for a client. Same error but different symptoms. I was able to narrow the issue down to a specific concatenation of dateparts and then converting to a datetime as well as a specific join causing the problem on one of my queries.

    My issue was resolved by adding indexes on the join table.

    example:

    select convert(datetime, A.MO + '/' + A.DY + '/' A.YR)

    from A

    join B on A.id = b.id

    left join C on A.id = C.id

    AND a.id2 = C.id2

    In the example above there weren't indexes on table C. As soon as I added them on id and id2 the error went away. Hope this inspires you to look a different direction and resolve your issue.

    Remember this when a developer tells you it will just be temporary. Temporary = Permanent.

  • 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.

  • 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.

  • 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

  • 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?

  • 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

Viewing 15 posts - 1 through 15 (of 33 total)

You must be logged in to reply to this topic. Login to reply