SMSS templates

I have following question:

I use SMSS template - "Create New Procedure (New Menu)" for creating sp. This template place comments before CREATE PROCEDURE statement. Comments include "Create date:". Whenever I edit procedure (created with mentioned template) with SMSS, the CREATE PROCEDURE statement is correctly replaced with ALTER PROCEDURE. My coworkers use Query Analyzer to modify procedures. The problem arose, when they want to alter such a procedure, because query analyzer replaces "Create date" to "ALTER date" (in comments) instead of replacing "CREATE PROCEDURE" to "ALTER PROCEDURE".

My question is not "how to avoid this behavior"(the answer would be simple), but if placing comments to store procedure before first statement of sp is wise(= could not cause any other problems).

Right now, I am contemplating, if it is better to edit "Create New Procedure (New Menu)" template and place comments inside body of sp, or it is enough to change "Create date:" to e.g. "cDate:" ...

Personally, I consider place before first statement of sp as more suitable place for comments.

Thanks for answer in advance

ONO


Answer this question

SMSS templates

  • codingIntern

    It is not a question of SQL Server Managment Studio, it is question of Query analyzer my coworkers uses.

    SQL Query Analyzer claim to be:
    SQL Distributed Management Framework (SQL-DMF)
    SQL Query Analyzer
    Version SQL 8.00.760

    database is:
    SELECT @@VERSION
    Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 4)


    Run this script via SQL query analyzer:

    -- =============================================
    -- Author: dankoo
    -- Create date: 23/1/2005
    -- Description: test proce
    -- =============================================
    CREATE PROCEDURE tst
    AS
    PRINT 'this is proc'


    It is suppose to create tst procedure. Then find the procedure via Object browser and right-click on procedure. Select edit and you would get:

    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_NULLS ON
    GO

    -- =============================================
    -- Author: dankoo
    -- ALTER date: 23/1/2005
    -- Description: test proce
    -- =============================================
    CREATE PROCEDURE tst
    AS
    PRINT 'this is proc'



    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO

    ... I would expect that CREATE PROCEDURE changes to ALTER PROCEDURE and not Create date to ALTER date...

    Thanks




  • Gregg Boer MSFT

    I have not been able to reproduce your issue. Are you on the RTM version of SQL Server Management Studio

    If you have the RTM version can you explain how I would be able to reproduce (please supply example script as well)



  • D. Swicegood

    I see your point; you use SSMS to create a SP, but your colleagues use QA to edit these. Apparently QA is bluntly doing a search for CREATE [ANYTHING] and replaces this indeed incorrectly. For now I would work around this by changing the CREATE DATE with something else. In the mean time I will file a bug to get some attention for this issue, so it can be fixed in a future release (pending team decision).

  • SMSS templates