When I script out a Stored Procedure it encloses stings in Double Quotes?

  • All of a sudden hen I script out a Stored Procedure it encloses strings (edit) in Double Quotes?

    For example

    ANDPromo.[Group] IN (''FL_Small'',''FL_Large'')

    Also it generates this code that I do not want. I just was Create Procedure...

    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_IncentiveReport]') AND type in (N'P', N'PC'))

    BEGIN

    EXEC dbo.sp_executesql @statement = N'

    What options do I need to set?

    Thank you.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Odd, is there anything in Tools > Options > SQL Server Object Explorer > Scripting ?

  • Welsh Corgi (7/10/2014)


    All of a sudden hen I script out a Stored Procedure it encloses stings in Double Quotes?

    For example

    ANDPromo.[Group] IN (''FL_Small'',''FL_Large'')

    Also it generates this code that I do not want. I just was Create Procedure...

    IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_IncentiveReport]') AND type in (N'P', N'PC'))

    BEGIN

    EXEC dbo.sp_executesql @statement = N'

    What options do I need to set?

    Thank you.

    How are you scripting out the stored procedure?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • if SSMS scripting option below is selected, then dynamic SQL is generated to handle the if not exists, and that is what you are seeing.

    you pasted just a piece of the inner command, but the entire script is all dynamic SQL except for the object checking.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I want:

    ANDPromo.[Group] IN ('FL_Small','FL_Large')

    Not:

    ANDPromo.[Group] IN (''FL_Small'',''FL_Large'')

    The later throws a syntax error. I have not changed anything.

    Thanks.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • I changed the default on the script. I'm not sure how that changed. Thanks.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply