SQL Server:改变proc时的EXEC命令

时间:2017-11-10 19:01:01

标签: sql-server stored-procedures metadata alter

我想做这样的事情:

CREATE OR ALTER PROC myPROC
    @myInput NVARCHAR(MAX)
AS
BEGIN
    SELECT * 
    FROM myTABLE

    -- I want this next command to run not to be stored for later execution.  
    EXEC RegisterProcSomewhere
END
GO

有没有首选方法可以做到这一点?基本上我想在我CREATE/ALTER时收集我的程序元数据。

1 个答案:

答案 0 :(得分:0)

在proc之外调用它以立即执行它。

CREATE OR ALTER PROC myPROC
@myInput NVARCHAR(MAX)
AS
BEGIN
 SELECT * FROM myTABLE

 -------------------------------

END
GO

--I want this next command to run not to be stored for later execution. 
EXEC RegisterProcSomewhere