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.9k
How to delete from table in case code type have value or not
Jan 28 2020 1:04 PM
How to delete from table in case of code type have value ?
I have temp table #temppc
I need when codetype on temp table #tempPc not have null meaning have value
then
delete statement from table Parts.TradeCodes will be
DELETE
TCC
FROM
#TempPC t
INNER
JOIN
Parts.TradeCodes TCC
ON
t.ZPLID=TCC.ZPLID
and
t.CodeType=TCC.codeType
and if codetype on temp table #TempPc is null then delete statment from table Parts.TradeCodes will not have codetype
and it will be
DELETE
TCC
FROM
#TempPC t
INNER
JOIN
Parts.TradeCodes TCC
ON
t.ZPLID=TCC.ZPLID
so How to modify delete statment on query below that to delete based on two cases if codetype have value or not
create
table
#TempPC
(
[ID]
INT
IDENTITY,
ZPLID
INT
,
CodeType
int
)
DELETE
TCC
FROM
#TempPC t
INNER
JOIN
Parts.TradeCodes TCC
ON
t.ZPLID=TCC.ZPLID
Reply
Answers (
2
)
How to update status with conflict data where chemical temp
How to generate orgpath as column of datatype hierarchyid.