stored proc w double quotes wrapped around select

  • I'm looking ove rthis proc and i noticed theire using dynamic sql however instread of using ticks their using double quotes around the select string and assigning it to variable and executing it.

    i didnt think u could do this. When i run it and try and print the string i get nothing. Anyone farmiliar w this method?

    --example

    set @sql_tmplt =

    "

    insert into

    #ViewedOffers

    select top " + cast(@speed_count as varchar) + "

    ViewedOfferId,

    PersonId,

    ViewedDate,

    ''

    from

    dbo.InProcessVO with(nolock)

    where

    DeliveryDefId = " + cast(@p_DelivDefID as varchar)

    print @sql_tmplt

    --execute (@sql_tmplt)

  • Try

    SET QUOTED_IDENTIFIER OFF

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

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