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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Exporting a datetime as YYYYMMDD

Author  Topic 

icw
Constraint Violating Yak Guru

378 Posts

Posted - 2007-08-28 : 10:41:20
Hi I have a datetime column in a table.
i am using DTS to export the table.
I want to just get YYYYMMDD but when I export to a text file I get 2006-09-12 00:00:00:000.
Can anyone give me a tip to get this out the way i want it
thanks a lot

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-28 : 10:59:40
SELECT CONVERT(CHAR(10), Col1, 112)
FROM Table1



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

icw
Constraint Violating Yak Guru

378 Posts

Posted - 2007-08-28 : 11:03:19
Thanks, that's great!!
what does the 112 do?

Cheers
ICW
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-28 : 11:06:18
it's a convert option.
you can find it in BOL = Books Online under Convert

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-28 : 11:06:27
Look up CONVERT function in Books Online,
or read this topic http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=80563



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-28 : 11:08:20




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

icw
Constraint Violating Yak Guru

378 Posts

Posted - 2007-08-28 : 11:18:55
much appreciated......don't shoot!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-28 : 11:33:00
I shot myself. Missed by 9 seconds...




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -