Hi.
I am processing a very large text file, trying to update columns for exising members. However, somtimes the text file contains blank values and I don't want to overwrite values that exist with blank values. So, if the values (from text file) are blank, we don't update that column.
The code snippet below shows a partial update (there will be more columns, but if I can get an example with these, I can do the rest).
Notice the SET portion. Any of those values (@CityID, @AddressLine1, @ZipCode) could be blank and if it is, I don't want to include that line in the SET.
How do i write an UPDATE that looks at each variable (@CityID etc..) and determines if we should put it in the UPDATE statement.
I hope I am explaiing myself clearly.
Thanks in advance for any and all comments.
UPDATE Contact
SET
PostalAddressLine1 = @AddressLine1,
CityID = @CityID,
TerritoryID = @StateID,
PostalZipCode = @ZipCode
WHERE EntityID = 1
AND EntityValueID = @PersonID
Our community of experts have been thoroughly vetted for their expertise and industry experience.