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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Conversion to Date format

Status
Not open for further replies.

Smithsc

MIS
Joined
Apr 20, 2007
Messages
143
Location
GB
Using SQL 2000 server I've managed to convert a number (20100514) to a string (14/05/2010) using the following:

Right(Convert(VarChar, {Field}, 103),2) + '/' + Substring(Convert(VarChar, {Field}, 103), 5, 2) + '/' + Left(Convert(VarChar, {Field}, 103),4) as OMD

I now need to convert this string into a date format but what ever I've tried doesn't work. I've tried using cast and convert but they don't seem to work.

Does anyone have any ideas.

Many thanks

Stuart


 
why not keep the original format, it is the iso standard...

print cast(cast(20100514 as varchar) as datetime)

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top