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楼 果然很厉害。 谢谢,结贴,顶贴者都有份
相关问答:
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt tab2 字段:goodsid,goodskind(商品类型) tab3 字段:goodskind(商品类型),kindname 结果: 得到商品类型在一段时间 ......
1。怎样使xp_cmdshell能完整输出超过255个字符的字符串。 2。select 时,检索速度是与from后的 TABLE顺序有关,还是与where条件的顺序有关(TABLE数据多少 ) 在系统属性设定里有个选项,可以修改单字段输出字数限制. ......
需求如下: 学院 academy(aid,aname) 班级 class(cid,cname,aid) 学生 stu(sid,sname,aid,cid) 住宿区 region(rid,rname) 宿舍楼 build(bid,rid,bnote) bnote是‘男’/‘女’ 宿舍 dorm(did,rid,bid,bedn ......
现在有一个部门表dept(部门名称,部门号。。)有一个人员表emp(姓名,人员编号,职位,薪资,部门) emp表中的内容是这样的: a 1 工程师 3000 软件部 b 2 普通员工 2000 硬件部 c 3 工程师 4000 硬件部 d ......