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 |
kangle
Starting Member
5 Posts |
Posted - 2015-01-15 : 14:12:06
|
I hope this forum is appropriate for my question. I have a field where all of the data is 5 characters in length. The last character denotes a status and will always be an F, H, or T. I want to add a new field (which I will do manually) and populate the new field with the last character from the "old" field. Once that is complete, I want to eliminate that 5th character from the old field.OLD FIELD NEW FIELDB123F B123H B123T OLD FIELD NEW FIELDB123 FB123 HB123 TI assume the formatting may be lost but hope the description above is adequate to describe what I am trying to accomplish. Thanks in advance for any assistance you can provide. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-01-15 : 14:16:51
|
Please test:UPDATE t1SET NewColumn = RIGHT(OldField,1), OldColumn = LEFT(OldColumn, 4)Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
kangle
Starting Member
5 Posts |
Posted - 2015-01-21 : 11:19:57
|
Thank you Tara. Hopefully my SQL install will be repaired this afternoon and I will have an opportunity to test.Thanks again |
|
|
|
|
|