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 |
|
wkm1925
Posting Yak Master
207 Posts |
Posted - 2010-02-06 : 11:58:28
|
| My table and rows as follow,t1PriceGroup--------------SERMSPORE2RMSPORESG$WAHRMSPORESUNRMsporecnySG$As you can see, there's 2 character at the end of the word. The character is RM and SG$.How to remove that character? So, my resultset as follow,t1PriceGroup--------------SESPORE2SPOREWAHSPORESUNsporecnyNeed help |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-06 : 12:04:14
|
| [code]UPDATE t1SET PriceGroup=LEFT(PriceGroup,LEN(PriceGroup)-2)WHERE PATINDEX('%RM',Pricegroup) > 0UPDATE t1SET PriceGroup=LEFT(PriceGroup,LEN(PriceGroup)-3)WHERE PATINDEX('%SG$',Pricegroup) > 0[/code] |
 |
|
|
wkm1925
Posting Yak Master
207 Posts |
Posted - 2010-02-06 : 12:09:04
|
| tq sir |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-06 : 12:10:00
|
welcome |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-02-06 : 17:28:16
|
| @Visakh: I'm curious why PATINDEX rather than LIKE? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-07 : 10:31:10
|
quote: Originally posted by Kristen @Visakh: I'm curious why PATINDEX rather than LIKE?
you can use LIKE also. just used PATINDEX as it was a pattern search |
 |
|
|
|
|
|