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)
 Import with Datename error

Author  Topic 

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2006-12-14 : 02:58:32
I need to import a datatime field from other source.
However, with followings statement, the first one runs ok but the second one failure.

select datename(mm, '14/12/2006') from systab

select datename(mm, '12/14/2006') from systab


Which thing in SQL 2000 control the datetime import criteria? What's the best practice to handle this?

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2006-12-14 : 03:02:09
Use YYYY-MM-DD or YYYYMMDD

Duane.
Go to Top of Page

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2006-12-14 : 03:12:26
sorry, I don't understand. What factors control the date format for import?
Just run following script and get these errors.

select datename(mm, '20061212') from systab
select datename(mm, '20061214') from systab
select datename(mm, '20061412') from systab (Not working)

select datename(mm, '2006-12-12') from systab
select datename(mm, '2006-12-14') from systab (Not working)
select datename(mm, '2006-14-12') from systab
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-14 : 05:57:07
Read about SET DATEFORMAT in Books Online.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2006-12-14 : 21:13:41
Thx Peso,the help file is very clear and easy to understand.
Go to Top of Page
   

- Advertisement -