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)
 converting date filed into system date

Author  Topic 

venkath
Posting Yak Master

202 Posts

Posted - 2007-08-29 : 04:37:24
Hi

I have a text file which has a date field, while loading this field
i need to convert it into system date, how can i achieve this.

Help on this is greatly appreciated.

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-29 : 04:53:09
SELECT CAST(Col1 AS DATETIME)
FROM Table1




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

venkath
Posting Yak Master

202 Posts

Posted - 2007-08-29 : 06:48:51
i have date data already in the text file , i need to change this data to systemdate i.e getdate() while loading it into the table

Sorry for the confusion.

Please guide me to achive this.

Thanks
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-29 : 06:58:40
Use already known GETDATE() function, or the equivalent CURRENT_TIMESTAMP function.

If you need to FORMAT the datetime value, see here
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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-08-29 : 07:32:12
After you loaded the data into the table, updaet the table

Update table_name
set datecol=Getdate()

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -