Thread: SQL Server
View Single Post
  #2 (permalink)  
Old 08-26-2008, 11:12 AM
SandeshSegu SandeshSegu is offline
Junior Member
 
Join Date: Aug 2008
Location: Bangalore, INDIA
Posts: 6
SandeshSegu is on a distinguished road
Default ANY answer. Re: SQL Server

Hi,
Please use the below Query...

Quote:
use pubs
declare @String varchar(100)
Declare @SQL varchar(200)
set @String = '''CA'',''KS'',''TN'',''OR'''

Set @SQL= 'select * from dbo.authors where state in ('+@String + ')'
Print @SQL
exec (@SQL)
__________________
Thanks
Sandesh S
http://sanssql.blogspot.com/
Reply With Quote