Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 set @sql='update #temp set '+'absentee='+'A'

Author  Topic 

thomson
Starting Member

9 Posts

Posted - 2009-03-06 : 14:26:12
How could I write code

set @sql='update #temp set '+'absentee='+'A'
exec(@sql)

It doesn't work.How to deal with 'A' issue?
thanks

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2009-03-06 : 17:47:28
set @sql='update #temp set ' + 'absentee=' + ''A''


Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-03-07 : 01:36:08
That should be

set @sql='update #temp set ' + 'absentee=''A'''

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -