Link to home
Start Free TrialLog in
Avatar of BeyondBGCM
BeyondBGCM

asked on

regular expression in sql server

Ok, how can I write a regular expression which can tell me a particular row data is not correct date, out of a column , in a table with millions of records

column 1
01-Jan-15
01-Jan-15
01-Jan-15
01-Jan-15
01/Jan/15

what regular expression will return me row no. 5 from above table.
Avatar of PortletPaul
PortletPaul
Flag of Australia image

what version of SQL Server is it?

At SQL 2012 TRY_CAST() is available.

select
*
from table1
where try_cast(column1 as date) IS NULL

but the problem with this is performance my be poor on a large table (but the same is likely to be true with alternatives).
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BeyondBGCM
BeyondBGCM

ASKER

but, we can use regular expressions in .net since 1.1 release
ie from 2003
yes, in .Net, but not in sql server directly
using .net means you would have to bring all the relevant table data from the server to the .net app