2017-11-10 7 views
0

Ich möchte so etwas wie dies zu tun:SQL Server: EXEC-Befehl während Ändern proc

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 

Gibt es eine bevorzugte Art und Weise, dies zu tun? Im Wesentlichen möchte ich Metadaten zu meinem Verfahren sammeln, wenn ich sie ihnen.

+0

Klingt, als ob Sie einen DDL-Trigger benötigen könnten –

Antwort

0

Rufen Sie es außerhalb des Proc auf, um es sofort auszuführen.

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