how to add # special character in a string @mysql that will be used by exec @mysql

  • how to add # special character in a string @mysql that will be used by exec @mysql

    Hello all

    I have a temporary table used in pivoting

    so how to include #temp1 inside var @mysql

    that will be used in exec @mysql

  • declare @mysql varchar (1000)='create table #team1(a int); select * from #team1'

    exec (@mysql)

    I am not sure what you are looking for, but for # you don't need to do anything special.

    one more thing, once this is executed there won't be any temp table to work on furthur.

    declare @mysql varchar (1000)='create table #team1(a int); select * from #team1'

    exec (@mysql)

    select * from #team1

    /*

    (0 row(s) affected)

    (1 row(s) affected)

    Msg 208, Level 16, State 0, Line 3

    Invalid object name '#team1'.*/

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

  • Thanks

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

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