卜算子咏梅的名句:[急]请问SQL Server中查询语句!

来源:百度文库 编辑:中科新闻网 时间:2024/05/15 19:19:55
要写下例查询语句:

数据库有很多条记录:
如果记录中没有"/"或"*",则取完整记录,如果有"/"则取"/"前的,如果有"*"号,则取"*"号前的

select
case when charindex('/',列)>0 then left(列,charindex('/',列)-1) when charindex('*',列)>0 then left(列,charindex('*',列)-1) else 列 end
from 表