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 |
|
shaik.zakeer
Posting Yak Master
117 Posts |
Posted - 2008-08-20 : 06:21:14
|
| Hello i have a table with two cols...id date1 2008-08-202 2008-09-21 3 2008-01-01how can i update the month to december.Thanks in advanceThanks Zakeer Sk |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-20 : 06:25:52
|
| Select id, dateadd(month,12-month(date),date) from tableMadhivananFailing to plan is Planning to fail |
 |
|
|
shaik.zakeer
Posting Yak Master
117 Posts |
Posted - 2008-08-20 : 07:56:16
|
| thanks madhivananI wrote a sp like this.create proc datechange ( @Month int)asbeginupdate sample set date=dateadd(month,@month-month(date),date) endUsing this sp I can pass int as parameter and I can able update the table. If I pass month name instead of int.can I able to update.If I give month names as input. can I get the output as2008-November-202008-January-20-------------------Thanks Zakeer Sk |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-20 : 08:19:34
|
| declare @month varchar(10)set @month='december'select dateadd(month,month(cast(@month+' 2008' as datetime))-month(getdate()),getdate()) MadhivananFailing to plan is Planning to fail |
 |
|
|
shaik.zakeer
Posting Yak Master
117 Posts |
Posted - 2008-08-20 : 08:49:04
|
| gr8...thanks alothave a gr8 day.........Thanks Zakeer Sk |
 |
|
|
|
|
|