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 |
|
yaman
Posting Yak Master
213 Posts |
Posted - 2008-07-14 : 10:33:23
|
| Sir I have a year I want to create a date from Year Like i have YEAR = 2007 and i want to make a date Like 01-01-2008pls help me outYaman |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-14 : 10:35:28
|
SELECT DATEADD(YEAR, @Year - 1900, '19000101') E 12°55'05.25"N 56°04'39.16" |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-14 : 10:35:48
|
[code]declare @year intselect @year = 2007select dateadd(year, @year + 1 - 1900, 0)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-14 : 10:36:20
|
20 secs slower and wrong answer KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-14 : 10:41:42
|
| <<and i want to make a date Like 01-01-2008>>If you want first day of next year,select dateadd(year, @year+1 - 1900, 0)MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-14 : 10:43:33
|
Plus 1 minus 1899 equals to -1899.  E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|