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 |
edusqluser
Starting Member
15 Posts |
Posted - 2014-05-09 : 17:48:53
|
I need to update the values in a table from:7F110-0100-010-00-PUBLISHING/GENERALto7F110-0100-010-00How to remove the text to the RIGHT of the numeric valuesTHX, EDUSQLUSER |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-05-09 : 17:51:14
|
Will it always be 17 characters that you want to keep?select LEFT(column1, 17)from t1If you want to update the data, then: update t1 set column1 = LEFT(column1, 17)Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-05-12 : 07:19:12
|
if length is varying you can use thisselect LEFT(column1, PATINDEX('%-[A-Za-z]%',Column1 + '-A')-1)from t1or update t1 set column1 = LEFT(column1, PATINDEX('%-[A-Za-z]%',Column1 + '-A')-1) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
edusqluser
Starting Member
15 Posts |
Posted - 2014-05-12 : 18:39:18
|
Awesome! I appreciate it!THX, EDUSQLUSER |
|
|
|
|
|