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 |
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2010-11-30 : 04:37:15
|
| how can i write this in query:SELECT CASE WHEN convert(datetime,(convert(varchar,e.OBPLDT))) IS ERROR THEN '1900-12-31' ELSE convert(datetime,(convert(varchar,e.OBPLDT))) ENDFROM ..WHERE...--------------------------------suppose i get this value '101010'SELECT convert(datetime,(convert(varchar,'10101010')))then i get error "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value"so i do not want that query will fall |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2010-11-30 : 05:21:39
|
| I think you're looking for the ISDate function.--Gail ShawSQL Server MVP |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-30 : 08:26:07
|
| What is the format of the varchar date?MadhivananFailing to plan is Planning to fail |
 |
|
|
inbs
Aged Yak Warrior
860 Posts |
Posted - 2010-12-01 : 00:49:13
|
| i think isdate is better function |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|