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 |
|
ShaunBetts
Starting Member
7 Posts |
Posted - 2009-08-06 : 08:25:45
|
| I want to repace some numbers at the end of some text for example shaun100000 and i want to repalce it with shaun100001 and so on to about 500000my current SQL is SELECT REPALCE (_STRING_TEXT,'100000', i am then not sure how to finish it, i a, not sure if the above is right, however i thoight it could work after takeing bits from tutorial on the web Thanks |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-08-06 : 08:31:31
|
| HiAm not sure what u expect...SELECT REPLACE('shaun100000','100000','100001')-------------------------R..http://code.msdn.microsoft.com/SQLExamples/http://msdn.microsoft.com/hi-in/library/bb500155(en-us).aspx |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-06 : 08:44:38
|
| [code]select data,left(data,patindex('%[0-9]%',data)-1)+ltrim(substring(data, patindex('%[0-9]%',data),len(data))+1) as new_datafrom( select 'shaun100001' as data union all select 'shaun100002' union all select 'shaun100003') as t[/code]MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|