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 |
|
kote_alex
Posting Yak Master
112 Posts |
Posted - 2009-06-05 : 05:50:36
|
| how can I select a column but I have some unwanted letters in my select ... like these ROCNP 2661201354755ROCNP 1691209052867ROCNP 2790426253200ROCNP 2800929115178 how can I select only the numbers ? without the ROCNP ? |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-06-05 : 06:02:22
|
| select LTRIM(replace(column,'ROCNP,''))FROM TABLE |
 |
|
|
kote_alex
Posting Yak Master
112 Posts |
Posted - 2009-06-05 : 09:48:06
|
| it worked ! thanks !!! but now how can I make a select from that select ?because like this it doesn't workselect LTRIM(replace(T1.Codfiscal,'RO',' ') from ( select LTRIM(replace(Codfiscal,'ROCNP',' ')) FROM a_temp ) T1 |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-05 : 10:11:25
|
What is your wanted output? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-06-05 : 10:19:15
|
| try thisselect LTRIM(replace(T1.Codfiscal,'RO',' ') from( select LTRIM(replace(Codfiscal,'ROCNP',' ')) as Codfiscal FROM a_temp ) T1and go through Replace Function in sql server.You will get answers to your queries. |
 |
|
|
kote_alex
Posting Yak Master
112 Posts |
Posted - 2009-06-05 : 10:22:09
|
| as I said before I have unwanted char in my column... 4 to 5 letters stacked together with numbers ... so from RO3245667 and rocnp32545456 and ror2356677 ... i just want to filter the numbers without the letters ... and I have to make multiple selects but with only one column output . |
 |
|
|
kote_alex
Posting Yak Master
112 Posts |
Posted - 2009-06-05 : 10:23:47
|
quote: Originally posted by raky try thisselect LTRIM(replace(T1.Codfiscal,'RO',' ') from( select LTRIM(replace(Codfiscal,'ROCNP',' ')) as Codfiscal FROM a_temp ) T1and go through Replace Function in sql server.You will get answers to your queries.
thanks... it worked... :D |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-06-05 : 11:42:40
|
| welcome... |
 |
|
|
|
|
|
|
|