Home Forums SQL Server 2008 SQL Server 2008 - General how to add # special character in a string @mysql that will be used by exec @mysql RE: how to add # special character in a string @mysql that will be used by 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: