I am new to SQL - fumbling and googling my way through some of the more complicated statements -
In this situation either of these dates may exist which is the reason for coalesce - syntactically I do not get an error with how this is coded but when I run the proc I get the trailing message -
CAST(cast(coalesce(nullif(l.eldldt,0), nullif(l.elupdt,0),0) as varchar(10)) as date)
returns the following message
Msg 241, Level 16, State 1, Line 34
Conversion failed when converting date and/or time from character string.
I did go back and review the data and found that there were some existing records where there was no value in elupdt. So that was causing an issue and probably the message. Thanks again for the direction!