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 |
PeteLeHoq
Starting Member
37 Posts |
Posted - 2014-11-25 : 11:44:21
|
I have a table with a 25,000 records with fields like this:Jan 1 196Jun 29 195Jan 22 196Sep 17 195Mar 22 193Nov 3 197Is there a quick way to add the zero onto the year, before I convert them into datetime format? |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-25 : 11:52:44
|
update tableset field = field + 'o' |
|
|
PeteLeHoq
Starting Member
37 Posts |
Posted - 2014-11-25 : 12:16:52
|
Sorry forgot to mention they are mixed in with other records, like this:Oct 29 1954 12:00AMMay 13 1964 12:00AM10/28/201205/30/1971Dec 29 1961 12:00AM03/19/1961Jan 29 195Jun 16 19711/28/196906/24/198111/30/196010/27/1953Feb 28 195 |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-11-25 : 12:26:55
|
Then, you'll need a WHERE clause with the appropriate guards. Basically you want rows that end with 3 digits (LIKE '%[0-9][0-9][0-9]') but not 4 (NOT LIKE '%[0-9][0-9][0-9][0-9]') |
|
|
|
|
|