易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL取值问题 - MS-SQL Server / 基础类

表table 

  A B
  12*2+10*5
  4*3+10*4
  15*2+81*4

如何取B列中第一个*号前的数,并赋给A列
--search
SQL code:
select left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1)


--update

SQL code:
update table
set a = left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1)


select left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1) > 0


update table set a = left(b,charindex('*',b)-1) from table where left(b,charindex('*',b)-1) > 0


SQL code:

update 表table set A=left(B,charindex('*',B)-1)


都是牛人啊。

没多少分,呵呵,权当意思下。新手。。不好意思。


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

Asp+sql server问题 - Web 开发 / ASP

我一个项目,有个插入操作,具体是这样的:
我有进货信息表。在出货时选择相应的进货信息,输入数量,选择部门后,点保存按钮,由于网络延时,点一下没有反映,于是用户就又点一下,导致一次插入了两条记录:
例: ......

求一时间比较的SQL 指令 - MS-SQL Server / 基础类

表数据
COL1 COL2 COL2 COL4 COL5
----------------------------------------------------------------------------------------------
2010-05-05 00:00 ......

关于SQL语句OR的问题 - Oracle / 高级技术

通过NAME字段条件查询一个数据表,假设我有100个姓名,有以下两个方法,
方法1:
把100个Name 组成一个SQL语句,比如 Select * from tmp_table where Name='张三' or Name ='李四' Or ...Or Name='第一百个姓名'
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号