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 2008 Forums
 Transact-SQL (2008)
 update query

Author  Topic 

sharona
Yak Posting Veteran

75 Posts

Posted - 2011-03-07 : 15:01:00
i have a query that updates values into a column in a temp table if the note value is = to the 'note_rapid_resp_recommendations_ft1'
i have some users that dont have that particular note value but i would null inserted or blank if they dont have the value, how do i do that?

UPDATE #Final
SET AIRWAY_BREATHING = r.Value_TEXT
FROM #Result r, #Final f
WHERE f.ClientDocGUID = r.ClientDocGUID
AND r.name = 'note_rapid_resp_recommendations_ft1'

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2011-03-07 : 17:16:44
I'm not clear if this is the logic you want implemented but....[CODE]UPDATE #Final
SET AIRWAY_BREATHING = case
when r.name = 'note_rapid_resp_recommendations_ft1' then NULL
else r.Value_TEXT
end
FROM #Result r, #Final f
WHERE f.ClientDocGUID = r.ClientDocGUID[/CODE]This "should" update to r.Value_TEXT unless the Name is your special string.

=======================================
Elitism is the slur directed at merit by mediocrity. -Sydney J. Harris, journalist (1917-1986)
Go to Top of Page
   

- Advertisement -