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 |
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2011-10-11 : 17:16:12
|
| Help! in the conversion process of some data from excel to the sql side, excel altered the year of some person's DOB's from being born in 19xx to far future dates, like 2048, etc, etc. Obviously this is WRONG and BAD.So, asap, i need help with the syntax for a script that will first locate any DOB's within the table with a date beyond 10/11/11, and second, will update only the first two digits of the year from a "20" to a "19"thanks in advance! |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2011-10-11 : 17:36:47
|
| Disregard the request for the select statement to find those dates. I figured that part out. Now i just need the syntax for the update statement which will decrease everyone's DOB by 100 years for anyone with a DOB beyond 1/1/2011. Help! |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-10-11 : 17:51:02
|
| UPDATE yourTableSET DOB = DATEADD(year,-100,DOB)WHERE DOB > '20110101'JimEveryday I learn something that somebody else already knew |
 |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2011-10-11 : 21:26:11
|
| Your quote holds true for me!thanks a millionJames |
 |
|
|
|
|
|