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)
 Insert date from excel to datetime sql server 2005

Author  Topic 

prashantdighe
Starting Member

21 Posts

Posted - 2012-02-17 : 02:00:20
Hey guy some freaking problem is here,

My Excel data is:

17-02-2012

I tried :

INSERT INTO Session_Details (Session_Date) SELECT Convert(SMALLDATETIME,t2.Session_Date,101) FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 8.0;IMEX=1;HDR=YES;DATABASE=C:\inetpub\wwwroot\Feedback\Program_Data\Book4.xlsx', 'Select * from [Sheet1$]') t2

But I get

Msg 242, Level 16, State 3, Line 1
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
The statement has been terminated.

PLEASE GIVE SOME IDEAS!!!!!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-02-17 : 03:30:12
you probably have bad data in Session_Date


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

prashantdighe
Starting Member

21 Posts

Posted - 2012-02-17 : 03:54:05
ok that`s mean which data should be there?????
or in which format?????
plz reply!!!!!!!!!
Go to Top of Page

prashantdighe
Starting Member

21 Posts

Posted - 2012-02-17 : 04:14:40
Thnks a lot I resolve the porblem!!!!!!!!!!
Go to Top of Page
   

- Advertisement -