日期:2014-05-18  浏览次数:20478 次

查询一列字段的中间字符
我的数据库中有一个字段的内容是: <pre> aabbccddee </pre>
我想显示的时候显示的是aabbccddee,请问SQL语句应该怎么写

------解决方案--------------------
select substring(col , charindex( '> ' , col) + 1 , charindex( ' </ ' , col) - charindex( '> ' , col) - 1)
from tb
where charindex( '> ' , col) > 0 and charindex( ' </ ' , col) > 0 and charindex( ' </ ' , col) > charindex( '> ' , col)