SQL Server: Why would i add “;1” to the end of a stored procedure name?

前端 未结 3 1408
孤独总比滥情好
孤独总比滥情好 2021-01-11 11:04

i came across a compatibility issue today, as a customer upgraded from Windows XP to Windows 7.

The (12 year old code) is calling a stored procedure on the SQL Serve

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-11 11:48

    see CREATE PROCEDURE (Transact-SQL) SQL Server 2008 documentation

    --Transact-SQL Stored Procedure Syntax
    CREATE { PROC | PROCEDURE } [schema_name.] procedure_name            [ ; number ]  <<<<<<
        [ { @parameter [ type_schema_name. ] data_type } 
            [ VARYING ] [ = default ] [ OUT | OUTPUT ] [READONLY]
        ] [ ,...n ] 
    [ WITH  [ ,...n ] ]
    [ FOR REPLICATION ] 
    AS { [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }
    [;]
    
     ::= 
        [ ENCRYPTION ]
        [ RECOMPILE ]
        [ EXECUTE AS Clause ]
    

    ;number

    An optional integer that is used to group procedures of the same name. These grouped procedures can be dropped together by using one DROP PROCEDURE statement.

    Note:

    This feature will be removed in a future version of Microsoft SQL Server.
        Avoid using this feature in new development work, and plan to
        modify applications that currently use this feature.
    

    Numbered procedures cannot use the xml or CLR user-defined types and cannot be used in a plan guide.

    you can use this system view to find all of these and begin to rewrite them as separate procedures:

    sys.numbered_procedures (Transact-SQL)

提交回复
热议问题