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 |
|
pat74
Starting Member
1 Post |
Posted - 2011-10-11 : 04:59:13
|
| I have a column with data looking like this'1-10-10-1 9001''1-10-1-10 9011''7-8-10-1 9001'I need to remove the first part (x-x-x-x). Any suggestions?? |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2011-10-11 : 05:03:21
|
| Select SUBSTRING ('1-10-10-1 9001',3,LEN('1-10-10-1 9001'))Senthil.C------------------------------------------------------MCTS - [Microsoft][ODBC SQL Server Driver]Operation canceled |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-10-11 : 05:06:16
|
| right(col,charindex(' ',reverse(col)))or mayberight(col,charindex(' ',reverse(col))-1)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-11 : 05:20:17
|
make sure you identify only those records having the above format. else charindex will failie use where condition likeWHERE charindex(' ',reverse(col))>0------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|