...

View Full Version : for each id run query



Kal
07-04-2007, 01:19 PM
Hi guys,

i'm new to asp so this may seem easy to some people.

but i have a variable called kal, which is a comma seperated list of id's, how can i run a query to update all records on an mssql db where the id's are equal to the ones listed in the variable kal.

any help would great.

thanks in advance.

Roelf
07-04-2007, 01:33 PM
update tablename
set fieldname = value
where id in (1,2,3,4,5,6,7,8)

Kal
07-04-2007, 01:37 PM
where you have the comma seperated values could i just simply put my varaible name in there?

Spudhead
07-04-2007, 05:00 PM
Yes.

strIds = "1,2,45,46"
strSQL = "update tablename set fieldname = value where id in (" & strIds &")"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum