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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Preparing date for import [SOLVED]

Author  Topic 

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2008-01-18 : 08:37:09
I have several csv files which have a date field in the format 'YYMMDD'. However, it appears that after the year 2000 the year portion became 107 for 2007, 102 for 2002 etc. So, 106823 for August 23rd, 2006.

I'm wondering how to correct this weird formatting to give the standard 'YYMMDD' which I require.

Any suggestions would be gratefully received.

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2008-01-18 : 09:16:00
OK, so now I'm thinking that if I create a table with a column of type int instead of date for the date data I can have 1070823. H

How then can I then replace all references to '10' at the beginning of the field with , say, 2007 please? I can then get 20070823 and then modify the column type to date?
Go to Top of Page

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2008-01-18 : 10:42:38
Figured it out.
Go to Top of Page
   

- Advertisement -