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 |
|
jjz
Starting Member
31 Posts |
Posted - 2009-03-17 : 08:24:34
|
| Hi allplease assist.I am trying to strip an alpha numeric field in SQL Server 2005. The disired output is the last 6 digits of this field.e.g. AU3071801890desired output: 801890How do I go about doing that?Please also note that I cannot do this one by one as I need to do this on a couple of records. I have already imported this file. |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-17 : 08:26:17
|
If you are sure that last 6 fields will be numeric , you can simply use...select right(column_name,6) from yourtable |
 |
|
|
jjz
Starting Member
31 Posts |
Posted - 2009-03-17 : 08:35:17
|
| thanx a mil, it worked perfectly for the numeric fields like you said, however I have alpha numeric as well |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-17 : 08:36:42
|
| can you post the exact case and output just to be sure ? |
 |
|
|
jjz
Starting Member
31 Posts |
Posted - 2009-03-17 : 09:37:43
|
| here is what i am trying to do.22795B0IKQ88desired output: 0IKQ88THX |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-17 : 09:47:23
|
ok. Then the same thing should work.select right(column_name,6) from yourtable |
 |
|
|
jjz
Starting Member
31 Posts |
Posted - 2009-03-17 : 10:15:12
|
| you've been a great help. thank you |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-17 : 10:32:48
|
| np |
 |
|
|
|
|
|