select id,score1=case charindex('-',score) when 0 then score else left(score,charindex('-',score)-1) end,score2=case charindex('-',score) when 0 then score else substring(score,charindex('-',score)+1,8000) end
from ball
from ball
解决方案 »
- 我现在有几个*.btr的数据库文件,我怎么能把里面的数据取出来.有谁知道?先谢了,急..
- 关于一道老题,请教两个问题。
- 急!!!关于两表关联,求部门中平均工资大于3000的员工所在部门的平均工资?????
- 关于MSSQL里的帐号问题。SA帐号,安全性等。
- 能不能给dateadd函数里传值进去?
- 字段内这种批量替换有没有办法?
- 想问一下 这样的一条sql语句怎么写??
- 如何TOP N条记录呢,按分类,比如一个表内,每个客户有好多个商品,现在都取N个,如何写呀
- SQL 基础语法问题(左连、右连、内连)
- Sql2000或2005的个人版和企业版,执行同一存储过程时耗时相差很大,请问该如何解决?
- 关于变量的问题
- 关于动态报表
insert @ select 1,'1' union all select 2,'1-2' union all select 3,nullselect id,case when scroe is null then null when charindex('-',scroe)=0 then scroe else substring(scroe,1,charindex('-',scroe)-1) end as Scroe1,
case when scroe is null then null when charindex('-',scroe)=0 then scroe else right(scroe,len(scroe)-charindex('-',scroe)) end as Scroe2
from @--结果(3 row(s) affected)id Scroe1 Scroe2
----------- ---------- ----------
1 1 1
2 1 2
3 NULL NULL(3 row(s) affected)
from ball
id scroe1 scroe2 start-flag?
非要用sql语句为难自己呢?