0

Fairly self-explanatory. I have a table with a FirstName and LastName column. Whenever values for both have been recorded, I'd like a trigger to concatenate both together into another column called FullName. I'm not sure how to create this trigger, as it would need to fire only when both FirstName and LastName have been populated.

Here's some rough pseudo-code:

When FirstName is not null && LastName is not null
concat FirstName, LastName
Input into FullName

I haven't personally seen a condition that requires two columns to be populated for the trigger to fire, so I'm open to alternatives as well. Any assistance will be greatly appreciated. Thank you.

  • The condituon looks exactly like you would do it in a select query. Plus, a generated column would probably be better for this purpose as opposed to a trigger. – Shadow Jan 29 '21 at 19:35
  • Or just use coalesce() to handle null values – Shadow Jan 29 '21 at 19:45

0 Answers0