According to the Microsoft Documentation sp_send_dbmail
must be a semicolon delimited list. However, in many of my applications I am unable to guarantee that this list will be clean. I need a robust way for ensuring a syntactically valid list of emails such that my applications will not break if it isn't.
I've been looking into XML PATH
, STUFF
, and other methods, but the syntax is hideously confusing. Does anyone have a handy method in their bag of tricks (no stored procedures or functions please, I'd like an out-of-the-box solution)?
Conceptually I thought it best to part the CSV list into a temp table, handle each email separately, then recompose the list using a semicolon delimiter instead. I suspect there is a better method though.
Again, I would like an out-of-the-box solution if at all possible. :)