I am running the following query:SELECT *FROM R9.tb_IT0041_176575DatesWHEREISDATE([Date Z6]) <> 0 AND(([Date Type Z6-Date of Death] <> 'Z8') AND (ISNULL(LTRIM(RTRIM([Date Z6])),'') <> '' AND convert(datetime,[Date Z6]) > getdate()))
It generates the following error:Msg 241, Level 16, State 1, Line 1Conversion failed when converting datetime from character string.
Clearly I'm not excluding the non-date values from the [Date Z6] column correctly, Can anyone help me get this working?Basically, we want to make sure that if [Date Z6], which is the Date of Death, is populated, it is not a date in the future for anyone with a value of 'Z8' in the [Date Type Z6-Date of Death] column.