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 |
|
JohnBarry
Starting Member
1 Post |
Posted - 2012-03-20 : 14:29:44
|
| Hello everyone!I have a little problems, using PSQL.I have a long number, for example 123456789 and now i have to increase the 5th number of left by 1. In my example the result would be 123466789.I am trying to solve this but i failed... somebody an idea?best regards |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-20 : 14:45:22
|
| UPDATE tableSET Field=STUFF(Field,5,0,SUBSTRING(Field,5,1))------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-03-21 : 07:02:47
|
quote: Originally posted by visakh16 UPDATE tableSET Field=STUFF(Field,5,0,SUBSTRING(Field,5,1))------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
It should beUPDATE tableSET Field=STUFF(Field,5,1,SUBSTRING(Field,5,1)+1)MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-03-21 : 07:06:53
|
quote: Originally posted by JohnBarry Hello everyone!I have a little problems, using PSQL.I have a long number, for example 123456789 and now i have to increase the 5th number of left by 1. In my example the result would be 123466789.I am trying to solve this but i failed... somebody an idea?best regards
What if the fifth digit is 9?If the total length is 9, tryselect col+10000 from tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|