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

能否将指定字符后面的数据删除
字段类型为varchar,能否将此字段指定字符后面字符串删除

比如表名为:art;字段为title;  
title里面的有一个字符串,如:你好吗-你好吗-中国!
我要去掉的是第一个“吗-”后的字符串!

不知道能不能实现

------解决方案--------------------
select left(title,charindex( '吗- ',title+ '吗- ')-1) from [art]

------解决方案--------------------
update [art] set title=left(title,charindex( '吗- ',title)-1) where charindex( '吗- ',title)> 0