Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

how to add # special character in a string @mysql that will be used by exec @mysql Expand / Collapse
Author
Message
Posted Saturday, August 04, 2012 11:10 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, December 05, 2012 11:31 AM
Points: 74, Visits: 164
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
Post #1340202
Posted Sunday, August 05, 2012 6:34 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, April 09, 2014 9:03 PM
Points: 1,128, Visits: 1,161
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
Post #1340259
Posted Sunday, August 05, 2012 8:51 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, December 05, 2012 11:31 AM
Points: 74, Visits: 164
Thanks
Post #1340327
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse