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 2000 Forums
 Transact-SQL (2000)
 Dynamic SQL question

Author  Topic 

pbs1313
Starting Member

2 Posts

Posted - 2004-10-19 : 18:42:20
Hi. I need some help w/ Dynamic SQL for a stored procedure I need to produce. I'm a web dev, and not a DBA, but this task has fallen to me for this project anyway.

I'm trying to update some values in a table and can't get this to work. Ultimately, I will pass in a comma delimited string for @EntryIDList and an int for @CategoryID.

declare @CategoryID int set @CategoryID = 1
declare @EntryIDList varchar(250)
set @EntryIDList= '1006,1009,1034'

declare @finalist int set @finalist = 10

update dbo.ContestEntry
set ContestStatusID = @finalist
from dbo.ContestEntry e
join dbo.EntryVoteSummery s
on e.EntryID = s.EntryID
where e.CategoryID = @CategoryID
and e.entryid in @EntryIDList

What can I do to fix this error?:
"Line 13: Incorrect syntax near '@EntryIDList'."

Thanks.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-10-19 : 18:55:35
Duplicate:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=41471


Tara
Go to Top of Page
   

- Advertisement -