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 |
zeeshan13
Constraint Violating Yak Guru
347 Posts |
Posted - 2008-04-15 : 16:24:47
|
Hi All,I have a table called Table1 with a field called DateString with a nvarchar type. The records are like this;DateString1/11/20079/27/20062/22/20081/10/200711/13/20078/21/20075/23/20072/16/20071234567890011/20/2006It may not have date records which are just string like in this example is 12345678900. I need a SQL script which can identify those records which are not of date type. Please help.Thanks,ZeeThanks a million..Zee |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-04-15 : 16:25:53
|
Use the ISDATE built-in function. Check BOL for details.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
|
|
zeeshan13
Constraint Violating Yak Guru
347 Posts |
Posted - 2008-04-15 : 16:37:17
|
I got it.select * from Table1 where isdate(dateString) = 0 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-15 : 16:59:15
|
ISDATE() is not that reliable.Try SELECT *FROM Table1WHERE Col1 NOT LIKE '[0-9]%/[0-9]%/[0-9][0-9][0-9][0-9]' E 12°55'05.25"N 56°04'39.16" |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-16 : 01:22:16
|
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/09/24/handle-isdate-with-care.aspx |
|
|
|
|
|