返回的表增加一個列,列為自增長類型.如何做 select [id]=identity(int,1,1),b,c into # from 表select * from # 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 --临时表是一个解决方法--楼主如果B,C能确定唯一一条记录也可以这样写select 序号=(select sum(1) from 表 where b+c<a.b+a.c),* from 表 a 楼上的方法可以,另一解决方法是增加一个自增列:alter table 表名 add ID bigint identity(1,1) select identity(int,1,1) as id,lower(b) as b,lower(c) as c from tablename 更正一下select identity(int,1,1) as id,lower(b) as b,lower(c) as c into #t from tablenameselect * from #t 回复人: zlp321002(想在北京找份工作!) ( ) 信誉:104 2005-09-05 18:41:00 得分: 0 --临时表是一个解决方法--楼主如果B,C能确定唯一一条记录也可以这样写select 序号=(select sum(1) from 表 where b+c<a.b+a.c),* from 表 a --这个恐怕不行,搂主的排序不是这样的 选出每个父类ID=0的新闻1条 紧急求救!!!!!!!!!!!!!!!!!!!!!!!!!!!! 为什么我的查询分析器无法用互联网连另一台互联并装有数据库的机器~~~~~~~~~ sql server存储过程中如何求得2个变量的最大值 sql2008报表服务器问题 新新手初学MSSQL之问,BCB怎么连接MSSQL? 将数据库中某个长字段分成几个字段 SQL server2000中截去小数位保留整数位的函数是那个啊????? 请教:有点难度的SQL问题 各位高人,我在处理两台服务器分布式事务时遇到了如下问题 这里可否赋一个值让TABLE_A查出所有的记录? 组合字符串的问题
--楼主如果B,C能确定唯一一条记录也可以这样写
select 序号=(select sum(1) from 表 where b+c<a.b+a.c),* from 表 a
alter table 表名 add ID bigint identity(1,1)
select identity(int,1,1) as id,lower(b) as b,lower(c) as c into #t from tablename
select * from #t
--临时表是一个解决方法
--楼主如果B,C能确定唯一一条记录也可以这样写
select 序号=(select sum(1) from 表 where b+c<a.b+a.c),* from 表 a
--这个恐怕不行,搂主的排序不是这样的