lapucca
asked on
How can I modify this query so it won't change all degree col to null.
I ran this query 2 or 3 times. When I open the table, all degree column data is now null. How can I modify this so if degree doesn't meet any of the when condition then it doesn't get changed. thanks.
Update dbo.PersonDegree
SET degree =
case
when (degree='M.D.') then 'MD'
when (degree in('B.Sc.', 'B.S.', 'B.S', 'BS(High Honors)', 'BS/MS', 'B.sc.', 'BSc')) then 'BS'
when (degree IN('Ph. D.', 'Ph D', 'Ph.D.')) then 'PhD.'
when (degree IN('M.S.', 'Masters', 'M. Sci.')) then 'MS'
when degree='DMD' then 'DDM'
when degree ='Psy.D' then 'DPSY'
when degree in('B.A', 'B.A.') then 'BA'
when degree='B.M.S.' then 'BMS'
when degree='D.O.' then 'DO'
when degree='DNSC' then 'DSN'
when degree='M.A.' then 'MA'
when degree='M.B.B.S' then 'MD'
when degree='MS.B' then 'MSB'
when degree='P.A.' then 'PA'
when degree='MSN BS' then 'MSN'
End
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
when degree='MSN BS' then 'MSN'
else degree=degree
End