Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find all where a string cannot be converted to date

Status
Not open for further replies.

Savil

Programmer
Apr 28, 2003
333
EU
Hi All

I am migrating a db where the previous developer used a nvarchar field to hold dates. Subsequently there is all sorts of rubbish in the field that causes the script to fall over when transferring into a datetime field.

Does anyone know of a way I can search for all string entries in the field that cannot be converted to a date?

Thanks
 
Code:
Select *
From   YourTable
Where  IsDate(YourDateColumn) = 0


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Panic over

Thanks for the suggestion, I had already tried that but it was returning what looked to be valid dates. I then realised I was playing with UK date format but had not set DATEFORMAT dmy. Problem solved. There's a few US formatted dates in there, God knows how?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top