Search code examples
sql-serverstored-procedurescode-snippets

Is there any way to use code snippets feature of SQL Server to call stored procedure with it`s parameters with null value?


I have a stored procedure with several parameters and I call it every time like below code:

EXEC sp_General_AutoIncrement 
    @tbl_Name = 'tbl_General_MenuParents',
    @fld_Name = 'MenuParent_Code',
    @startWith = 1,
    @new_ID = @MenuParent_Code OUTPUT;

My question is:

Is there any way to use code snippets feature to create calling stored procedure or function with null or empty parameters and create the code quickly like this:

EXEC sp_General_AutoIncrement 
    @tbl_Name = '',
    @fld_Name = '',
    @startWith = 0,
    @new_ID = @MenuParent_Code OUTPUT;

What`s your idea?

Thank you for your attentions.


Solution

  • In Default you just can :

    Right Click > Script > Execute To
    

    But, There is plenty of commercial product options out there:

    Apex, SSM-Booster and RedGate SQL Prompt. 
    

    That you can define custom snippet.