TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
277.8k
How to write this statement with another way best without re
Mar 23 2020 12:50 PM
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 ?
Reply
Answers (
0
)
xml to SQL table
I am getting error "b" does not match table