笔记215 stuff转换

笔记215 stuff转换

 1 --stuff转换
 2 http://social.msdn.microsoft.com/Forums/zh-CN/sqlserverzhchs/thread/93d61400-3d1a-474a-a030-7d47b86ba7e1
 3 --> 测试数据: @T
 4 declare @T table (col varchar(21))
 5 insert into @T
 6 select 'ME-10#模垫φ70-角钢-2' union all
 7 select 'ME-105.5*29.5-1'
 8 
 9 select
10      substring(col,
11      charindex('-',col)+1,
12      len(col)-charindex('-',reverse(col))-charindex('-',col)) as col
13 from @T
14 
15 
16 
17 SELECT REVERSE(STUFF(REVERSE(STUFF(col,1,3,'')),1,2,'') )FROM @T
18 /*
19 col
20 ---------------------
21 10#模垫φ70-角钢
22 105.5*29.5
23 */

 

posted @ 2013-08-04 13:38 桦仔 阅读(...) 评论(...)  编辑 收藏