• Thanks for the article. I am currently re-writing a chunk of my code because, in this case, it's going to give me a huge performance gain. The format I have settled on is:

    DECLARE @query nvarchar(4000), -- // nvarchar using sp_executesql

    @LN char(1),

    @TB char(1),

    @lt-2 char(2)

     

    set @LN = char(10)                  -- // Line Feed

    set @TB = char(9)                   -- // Tab

    set @lt-2 = char(10) + char(9)        -- // Line feed + Tab

     

    set @query = ''

     

    set @query = @query

    + 'select column1,' + @lt-2

    + 'column2' + @LN

    + 'from table1 (nolock)'

     

    It is a little neater than having char() in lots of places.