• MG-148046 (1/3/2013)


    johnbrown105 56149 (1/3/2013)


    Michael R. OBrien Jr (1/2/2013)


    I guess I have never been a fan of triple quoting, I usually use CHAR(39) I find it is a lot easier to read for others:

    SELECT 'O' + CHAR(39) + 'Neal'

    Just a thought, nice article though

    +1

    +2

    In addition, I try to use Powershell Here-Strings wherever I can instead of dynamic SQL.

    Unless I'm misunderstanding what you are doing you will still need to keep multiplying the number of CHAR(39)s that you are using. So you would have

    REPLACE(@quotedvar, CHAR(39), CHAR(39)+CHAR(39))

    Certainly easier to read but I'm not sure if it wouldn't confuse me even more once I got down into multiple layers of dynamic SQL. i.e. Using dynamic SQL to generate more dynamic SQL.

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]