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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 pass parameter to where in() in store procedure

Author  Topic 

CVDpr
Starting Member

41 Posts

Posted - 2008-10-29 : 16:42:02
Hey, How can i pass this 1,2,3 to the parameter @num?
when i run this 'exec #tempSP 1,2,3' its say 'Has too many arguments specified.'


create procedure #tempSP

@num as int

as
begin
select *from #temp where number in (@num)
end

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-10-29 : 16:53:42
declare your @num as varchar.
exec yourSP '1,2,3'
See also: http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm
and search for fnParseList in this forum.

Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -