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