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

sql 更新某一列 - MS-SQL Server / 基础类

数据库中有一列,里面的值 或空或有值。
想更新这一列,将空值的部分添加数值,使更新后的值与原来的值不重复,最好是依次增长的顺序
可以试试用identity函数

SQL code:
declare @i int
set @i=1
update tb set @i=@i+1,col=ltrim(@i) where col is null


管理员很强大!!

学习了

引用
SQL code
declare @i int
set @i=1
update tb set @i=@i+1,col=ltrim(@i) where col is null

不错

引用
SQL code
declare @i int
set @i=1
update tb set @i=@i+1,col=ltrim(@i) where col is null

呵呵

引用
SQL code
declare @i int
set @i=1
update tb set @i=@i+1,col=ltrim(@i) where col is null

!!!!!

谢谢大家的跟帖,2楼 果然很厉害。
谢谢,结贴,顶贴者都有份


相关问答:

数据以xml格式返回 - MS-SQL Server / 应用实例

从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
   <folder state="unchecked&qu ......

求一个SQL语句 - MS-SQL Server / 基础类

字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......

sql语句问题 - MS-SQL Server / 疑难问题

现在有一个部门表dept(部门名称,部门号。。)有一个人员表emp(姓名,人员编号,职位,薪资,部门)
emp表中的内容是这样的:
a 1 工程师 3000 软件部
b 2 普通员工 2000 硬件部
c 3 工程师 4000 硬件部
d ......

sql语句问题 - Java / Web 开发

select o_customer,o_price from orders having o_price >=avg(o_price)
select o_customer,o_price from orders where o_price >=(select avg(o_price) from orders)
我感觉没有区别啊,怎么在mysql会有 ......

asp wap sql语句中获取的汉字不好事 - Web 开发 / ASP

SQL code:

rs.open "select * from guide where city_name='北京' order by pai desc",conn,1,1
do while not rs.eof or rs.bof
。。
。。
。。
rs.movenext
loop
这个sql语句在wap站里 本身有 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号