November 5, 2008 at 7:08 am
You only need to wrap the value in single quotes:
declare @ab varchar (100)
set @ab='483503'
select * from tm_temp_empmastall where employeeid=@ab
November 5, 2008 at 8:43 am
Use dynamic SQL to complete your query, and you can send the amount of employee you want:
Here's an example:
DECLARE @SQL NVARCHAR(1000)
DECLARE @ab NVARCHAR(100)
set @ab = '''483503'',''483504'''
SET @SQL = 'select * from tm_temp_empmastall where employeeid in ( ' + @ab
+ ' )'
PRINT @SQL
EXEC sp_executeSQL @SQL
Hope this helps,
J-F
Cheers,
J-F
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply