Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-04-10 : 07:09:00
|
| [code]CREATE PROCEDURE Delete_Template( @ID BIGINT, @Status BIT OUTPUT) BEGINBEGIN TRY BEGIN TRANSACTION DELETE A OUTPUT deleted.col1, deleted.col2 INTO audittable1( col1, col2) FROM maintable1 WHERE ID = @ID IF @@ROWCOUNT > 0 BEGIN DELETE A OUTPUT deleted.col1, deleted.col2 INTO audittable2 (col1, col2) FROM maintable2 WHERE ID = @ID END COMMIT SET @Status = 1END TRYBEGIN CATCH ROLLBACK TRANSACTION SET @Status = 0END CATCHEND[/code]this procecure created successfully but When I execute the procedure [code]DECLARE @Status AS BITEXEC Delete_Template 12, @Status OUTSELECT @Status [/code]It is giving me errorTransaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1.Can anyone suggest me how to remove this error or any other way to handle this...Please Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-04-10 : 08:13:48
|
| Sorry I got the solution that was just a syntax errorI have not given alias name A in table...Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
|
|
|