I work on SQL server 2012 i update two fields depend on every team id
- update dpt
- set Package=case when tmp.TeamId=1 then 1 end ,
- PackageDate=case when tmp.TeamId=1 then getdate() end ,
- Parametric=case when tmp.TeamId=2 then 2 end,
- ParametricDate=case when tmp.TeamId=2 then getdate() end ,
- Scribing=case when tmp.TeamId=3 then 3 end,
- ScribingDate=case when tmp.TeamId=3 then getdate() end ,
- Lifecycle=case when tmp.TeamId=4 then 4 end,
- LifecycleDate=case when tmp.TeamId=4 then getdate() end
- from PCN.DocumentPartTeams dpt inner join #Temp tmp on dpt.PartID=tmp.PartID and dpt.DocumentID=tmp.DocumentID
- and tmp.Status is null
I need to rewrite statement with another way best as following
because i repeat same condition multi time
i need to write it one time only meaning as below
case when teamid=2
then date=getdata and parametric=2
so how to do that please ?