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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
but, we can use regular expressions in .net since 1.1 release
ASKER
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
using .net means you would have to bring all the relevant table data from the server to the .net app
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).