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 |
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2007-10-23 : 09:05:30
|
Hi All,I need to extract some part of the column value from a table.For example:The values in the columnA are like IS01\costskIS01\palletpIS01\garbcI need to get the substring costskpalletpgarbcCan anyone tell me how to fetch only that part from the string?Thanks,-P |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-23 : 09:06:40
|
TrySelect substring(col,charindex('\',col)+1,len(col)) from tableMadhivananFailing to plan is Planning to fail |
 |
|
sqlpal2007
Posting Yak Master
200 Posts |
Posted - 2007-10-23 : 09:42:45
|
Thanks Madhivanan |
 |
|
Kristen
Test
22859 Posts |
Posted - 2007-10-23 : 09:47:32
|
Did you mean "everything after the '\', wherever it appears" then?Or "everything from 6th character onwards"?Kristen |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-23 : 09:48:44
|
quote: Originally posted by Kristen Did you mean "everything after the '\', wherever it appears" then?Or "everything from 6th character onwards"?Kristen
I think it is case 1MadhivananFailing to plan is Planning to fail |
 |
|
Kristen
Test
22859 Posts |
Posted - 2007-10-23 : 09:50:55
|
I think you are right. But the spec. was a little "loose" |
 |
|
|
|
|