Click here to Skip to main content
15,666,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello friends,

I have created the store procedure and I want to call it in another store procedure but the second store procedure gives an error.

Please solve my error thanks.

My store procedure is:
SQL
CREATE PROCEDURE TRN_PURBILL_INSERT
@ent_code	varchar(2)

AS
BEGIN TRY
	BEGIN TRANSACTION;
	if not exists (select ent_code from PURBILL WHERE ent_code=@ent_code)
	BEGIN
               -- call purchase bill insert store procedure
		EXEC SP_PURBILL_INSERT
               -- call invpart insert store procedure
		EXEC SP_INVPART_INSERT
               -- call bill charges insert store procedure
		EXEC SP_BILLCHRG_INSERT
	COMMIT TRANSACTION;
END TRY
BEGIN CATCH
	ROLLBACK TRANSACTION;
	RAISERROR('Error Occured While Entering Records!',16,1)
END CATCH		
GO
Posted
Updated 7-Sep-10 7:39am
v2
Comments
Sandeep Mewara 7-Sep-10 13:39pm    
What error? Adding that to your question would had been good.

1 solution

Your IF statement has a BEGIN but no END. It should have an END.
 
Share this answer
 
Comments
Dalek Dave 7-Sep-10 18:41pm    
Well Spotted.
Sagar Khairnar 55 8-Sep-10 1:01am    
THANK U SIR

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900