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
 SQL Server Development (2000)
 Updating 2 records in 1 query

Author  Topic 

outspaced
Starting Member

21 Posts

Posted - 2007-01-26 : 06:39:45
Is this possible?

i want something like:

update _featured_options set
Value = '15' WHERE OptionName = 'Bestsellers',
Value = '16' WHERE OptionName = 'FeaturedRelease'


... except something that actually works.

cheers,
Alex

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-26 : 06:41:57
update 2 table ? ?

update _featured_options
set Value = case when OptionName = 'Bestsellers' then '15'
case when OptionName = 'FeaturedRelease' then '16'
else Value
end


Oops.


KH

Go to Top of Page

outspaced
Starting Member

21 Posts

Posted - 2007-01-26 : 06:45:41
Doh! Sorry, I mucked up the subject. Silly me. Edited now.

Anyway that query gives me an error:

Server: Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'case'.


... Hmmmm :o/
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-26 : 06:58:10
updated the query


KH

Go to Top of Page

outspaced
Starting Member

21 Posts

Posted - 2007-01-26 : 07:31:12
Works great, thanks!
Go to Top of Page
   

- Advertisement -