In my sql server table i have a scenerio that column name:
DesignedStartDate if it is null then update the column otherwise don’t update the column
if(@ProcessStatus=‘QC Query Close’ or @ProcessStatus=‘QC Query Open’ or @ProcessStatus
=‘QC-Finished’ or @ProcessStatus=‘QC-Rejected’)
Begin
–print ‘QC’
Update specart set ProcessStatus=@ProcessStatus,QCRemarks=@QCRemarks
,DesignedBy=(Case when DesignedBy is null then @UserName end)
,DesignedStartDate=(Case when DesignedStartDate is null then getdate()+0.52 else DesignedStartDate end), DesignedEndDate
=(Case when DesignedEndDate is null then getdate()+0.52 else DesignedEndDate end), PRName
=(Case when PRName is null then @UserName else PRName end), PREndDate
=(Case when PREndDate is null then getdate()+0.52 else PREndDate end), QCName
=@UserName,QCEndDate=getdate()+0.52, LastUpdatedBy
=@UserName,LastUpdatedDate=getdate()+0.52
where specArtnumber=@SpecArtNumber
End