May 22, 2010 at 9:22 am
I recieve a strange error from sql server ,
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
when we use a return statement in the stored procedure.
Below the stored procedure:
create procedure sp_test
(
@a as int
)
as
begin
begin try
begin transaction
declare @b-2 as int
set @b-2 = 1
begin
select 'i am rolling back'
rollback tran
return 1
end
end try
begin catch
if @@trancount >1
begin
rollback tran
end
end catch
end
----------------------------------------------------------------------------------------------------------
when the stored procedure is executed in the below way,
exec sp_test 1
-----------------------------------------------------------------------------------------------------------
But we get error, when we execute in the following way...
can any one please help?
begin tran
exec sp_test 1
rollback tran
Kindest Regards,
Paarthasarathy
Microsoft Certified Technology Specialist
http://paarthasarathyk.blogspot.com
May 22, 2010 at 10:20 am
sorry for the error.. error reproducible only on sql 2005.
please excuse.
Kindest Regards,
Paarthasarathy
Microsoft Certified Technology Specialist
http://paarthasarathyk.blogspot.com
May 22, 2010 at 11:26 am
Appears to be a duplicate posting... refer to:
http://www.sqlservercentral.com/Forums/Topic926416-338-1.aspx
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply