November 5, 2009 at 2:18 pm
I realize that this syntax is wrong, but it describes what I would like to achieve.
UPDATE dbo.tblUsers
SET GroupId = '98'
WHERE UsrSName = 'shortname'
AND GroupID = '7'
OR SET GroupID = '99’
WHERE UsrSName = 'shortname'
AND GroupID <> '7'
I appreciate any help given.
November 5, 2009 at 2:27 pm
UPDATE dbo.tblUsers
SET GroupId = CASE GroupID WHEN '7' THEN '98' ELSE '99' END
WHERE UsrSName = 'shortname'
November 5, 2009 at 2:29 pm
Use CASE instead of OR
UPDATE dbo.tblUsers SET
GroupId =
CASE
WHEN GroupID = '7' THEN '98'
ELSE '99'
END
WHERE UsrSName = 'shortname'
Greets
Flo
November 5, 2009 at 2:47 pm
Thanks, John.
November 5, 2009 at 2:47 pm
Thanks, Flo.
November 5, 2009 at 8:51 pm
Heh... proof positive that great minds think alike. 😉 Look at the times on those two posts...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply