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 |
mohan123
Constraint Violating Yak Guru
252 Posts |
Posted - 2013-01-16 : 02:19:12
|
hello all,in my table i have 500000 records and 2 date fileds like date of Eligibility Coverage END 2005-11-01 00:00:00.000 2005-12-31 00:00:00.000now my requirement is i need to update 5000 records and 5000 records etc; with 2011-11-01 00:00:00.000 etc for all 50000 records now in another column i need to update columns with 3 month difference or 6 months diff or 1 year difference..basing on the date of Eligibility column how i need to do this one???P.V.P.MOhan |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-01-16 : 02:27:00
|
May be this?UPDATE TableName SET CoverageEND = CASE WHEN DateOfEligibility = value1 THEN dateadd( mm, 3 , DateOfEligibility )WHEN DateOfEligibility = value2 THEN dateadd( mm, 6 , DateOfEligibility )..........END--Chandu |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
|
|
|
|