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
 Transact-SQL (2000)
 Issue with date selection

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 13:25:00
Iam just importing data from excel to sql
SELECT emp_id,Grade_obtained,completed_date
FROM [Results$]

and the comleted_date is in the format like this (02-Jun-03)
.Its selecting the rest of the things but the completed_date is always being pulled as
NULL though thereis dates

surefooted
Posting Yak Master

188 Posts

Posted - 2004-10-11 : 13:34:51
What is the datatype of the destination column for completed_date?

-Jon
Now a "Yak Posting Veteran".
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 13:36:01
its datetime
Go to Top of Page

elwoos
Master Smack Fu Yak Hacker

2052 Posts

Posted - 2004-10-11 : 13:44:19
How are you importing the data? Can you convert to SQL datetime in the import?

steve

To alcohol ! The cause of - and solution to - all of life's problems
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 13:48:32
Before even importing I have a select statement as I have specified above is not selecting date its selecting only NULLS
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 14:46:19
Hi there when I converted the column in the excel to datetime as MM/DD/YY its getting seleting.No how will I use the select the corressponding format to select the data
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-10-11 : 15:01:51
There are dates in SOME of the rows...I bet there is also a header that is confusing it....

You need to show us exactly what it looks like in EXCEL...

Are you using DTS?



Brett

8-)
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 15:12:15
In excel the column name is completed_date and some of the rows are empty and some of them have
values like 26-Jun-03,02-Jun-03

Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 15:16:27
Iam using DTS as well So its not allowing the cast and convert
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-10-11 : 16:20:25
quote:
Originally posted by sqllearner

In excel the column name is completed_date



Take out the header row, then try it.

Did you tell DTS that the first row is a header?

Is the first row of data empty?

Did you try bcp?



Brett

8-)
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 17:19:25
The first row of data for the date is empty by but has the rest of the set populated.The interesting part is if I change the excel column to datetime then it pulls the data correctly
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-10-11 : 17:38:10
another interesting thing i found was I I insert a date in the 1st row then it picks the rest of them..Is this a bug in DTS
Go to Top of Page
   

- Advertisement -