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 |
|
Digital
Starting Member
8 Posts |
Posted - 2009-02-11 : 05:07:09
|
| Hi all I have a factsalesweekly table that im going to change to Daily there is a [Kweek] column numbered 1-100.... for example i want to update this column to [Kdate] e.g kweek kdate 1 = 200901012 = 200901023 = 20090103and so on for the first 31 days what would be the best way to update this so it concatenates looking at each number cheersDigital |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-02-11 : 05:10:03
|
UPDATE FactSalesWeeklySET kDate = DATEADD(DAY, kWeek, '20081231') E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Digital
Starting Member
8 Posts |
Posted - 2009-02-11 : 05:15:51
|
| sorry still pretty new to sql i get a error with that "Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query." any ideas of what its trying to do and where i should use the convertDigital |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-02-11 : 05:18:30
|
kDate is an INTEGER column, not a DATETIME column?UPDATE FactSalesWeeklySET kDate = CONVERT(CHAR(8), DATEADD(DAY, kWeek, '20081231'), 112) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
Digital
Starting Member
8 Posts |
Posted - 2009-02-11 : 05:26:03
|
| correct That looks like its done it hows does that dateadd function work its good to get answer here but better to understand Cheers PesoDigital |
 |
|
|
|
|
|