Update statement using case in SQL.
where the city is 'Agra Cantt' Update it to Agra
and where it is New Delhi update It to Delhi
Update dbo.TableEmployee
Set TableEmployee.City=
Case
When TableEmployee.City='
New Delhi' then '
Delhi'
When TableEmployee.City='
Agra Cantt' then '
Agra'
End
Good 1
ReplyDeleteIts a basic Query but very useful sometimes and is asked in most of the 0-1yr interview