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
 General SQL Server Forums
 New to SQL Server Programming
 Converting date in SQL

Author  Topic 

dg19
Starting Member

15 Posts

Posted - 2010-08-30 : 05:04:42
Hi All,

I have downloaded information from an AS400 containing over 900K records. i bulk inserted the info in an SQL Server 2000 table. Now my problem is that the date format stored in the AS400 is "cyymmdd" (IBM's century flag) i would like to convert the date into "YYYY-MM-DD" so that i could perform some statistical QUERY. My Question is thus is it possible to convert the "cyymmdd" into "YYYY-MM-DD" by SQL query for e.g "1100830" to "2010-08-30"? and whether anyone could give me a lead to this.

I have tried formatting the date in the CSV before bulk insert, its taking up lots of time and CPU process.

Thanks in anticipation.

Regards,
Amit

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-08-30 : 05:10:56
19000000 + CAST(cyymmdd AS INT)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -