Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
robnot
Starting Member
3 Posts |
Posted - 2007-08-08 : 14:47:26
|
I'm trying to use the following statement, meaning to return a string message if a date field is null., coalesce(adr.date_destroyed, 'Not Destroyed') I get an error message - Syntax error converting datetime from character string - and I'm not sure how to get around this. Is there a way I can disregard the type of the column and get the result I need? Is there a different way of going about this? Thanks, Rob |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-08 : 14:49:56
|
| Tried with isnull function? |
 |
|
|
robnot
Starting Member
3 Posts |
Posted - 2007-08-08 : 15:14:28
|
| I've tried isnull and also a case statement to handle the whole thing. They all have the same result. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-08-08 : 15:24:48
|
| You'll need to convert the column to varchar then run the function. This is because 'Not Destroyed' is not a valid date/time.coalesce(convert(varchar(50), adr.date_destroyed, 'Not Destroyed')Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
robnot
Starting Member
3 Posts |
Posted - 2007-08-08 : 15:47:39
|
| That did the trick, thanks so much! |
 |
|
|
|
|
|