Little help on some syntax

  • I currently have

    set @strbig ='db=' + @db + ' and (' + @word + '' + ')' which produces

    db=47 and ("steel" and "iron") and I need it to produce

    'db=47 and ("steel" and "iron")'.

    so when I try this set @strbig = ''db=' + @db + ' and (' + @word + '' + ')'' it blows up I can do this

    with " set @strbig = '"db=' + @db + ' and (' + @word + '' + ')"'. so its just not ok with the single ticks.

    thanks

  • I'm sorry, was there a question in there somewhere?

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • 465789psw (10/29/2009)


    set @strbig = '"db=' + @db + ' and (' + @word + '' + ')"'.

    That will give you the desired output.

  • yes I have this

    set @strbig ='db=' + @db + ' and (' + @word + '' + ')' which produces the following

    db=47 and ("steel" and "iron")

    I need it to produce 'db=47 and ("steel" and "iron")'.

  • rjv_rnjn (10/29/2009)


    465789psw (10/29/2009)


    set @strbig = '"db=' + @db + ' and (' + @word + '' + ')"'.

    That will give you the desired output.

    I didn't realize you had double quotes in there. The expression would be

    set @strbig = '''db=' + @db + ' and (' + @word + '' + ')''' Note that at the beginning and end of the expression you have three single quotes ('''). If you want a single quote in an expression then you need to escape it with another single quote.

  • thanks that worked

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

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