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.
Author |
Topic |
eljapo4
Posting Yak Master
100 Posts |
Posted - 2011-12-16 : 05:13:05
|
Hi, I'm trying to use the Import Data task to load data from an excel workbook into a database table. 3 of the excel fields are in time format i.e. HH:MM but when using the SQL wizard to do the import these 3 cols are being set with a datatype of datetime and a default date of 30/12/1899 is being used. I've tried to edit the mappings to use a time datatype but the import fails when I do this, is there anyway around this? |
|
eljapo4
Posting Yak Master
100 Posts |
Posted - 2011-12-16 : 05:56:07
|
I have imported the data to SQL and now I would like to use the DATEADD function to update 30/12/1899 to be today's date each time that the query is executed, can anyone help me with this?For example I have the following line of data:Customer DepotCode DepotName WindowTime Ferry Day Site PlanDespTime JourneyTimeJoe A08 WASHINGTON 1899-12-30 23:00:00.000 D1 S11 1899-12-30 23:00:00.000 9.75I would like to update the PlanDespTime field to be 'TODAYs DATE 23:00:00' |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-16 : 06:34:35
|
[code]UPDATE TableSET PlanDespTime=DATEADD(dd,DATEDIFF(dd,-2,GETDATE()),PlanDespTime)[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
eljapo4
Posting Yak Master
100 Posts |
Posted - 2011-12-16 : 06:54:14
|
Fantastic visakh16 - thanks very much |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-16 : 06:59:41
|
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|