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 |
|
vicki
Posting Yak Master
117 Posts |
Posted - 2002-03-25 : 11:31:34
|
| I got this error with the follwing code"Syntax error converting character string to smalldatetime data type"How do correct it?thanks alotISNULL(FO.PRNT_OCD,ISNULL(FO.ADOCD,''))as ReportsToOfficeCode |
|
|
izaltsman
A custom title
1139 Posts |
Posted - 2002-03-25 : 11:39:07
|
| I take it that both PRNT_OCD and ADOCD fields are of datatype smalldatetime, right? If that's the case SQL Server will expect that all values inside the ISNULL function will be smalldatetime (which blank string isn't!)... To get around the problem, try converting all values to varchar (I also replaced ISNULL with the COALESCE): COALESCE(CONVERT(varchar, FO.PRNT_OCD, 120),CONVERT(varchar, FO.ADOCD, 120),'')as ReportsToOfficeCode---------------Strong SQL Developer wanted in the Boston area. Please e-mail if interested. |
 |
|
|
|
|
|