如何在另一个存储过程中调用存储过程? [英] How to call store procedure in another store procedure ?

查看:88
本文介绍了如何在另一个存储过程中调用存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我已经创建了存储过程,并且想在另一个存储过程中调用它,但是第二个存储过程给出了错误.

请解决我的错误,谢谢.

我的存储过程是:

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:

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

推荐答案

您的IF语句具有BEGIN但没有END.它应该有一个END.
Your IF statement has a BEGIN but no END. It should have an END.


这篇关于如何在另一个存储过程中调用存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆