怎么将数据表中某字段编号(100分),在线等待。。。
怎么将数据表中某字段编号
编号9000000001
9000000002
9000000003
。
。
。
9000000010
。
。
。
我是10位的而且是9开始的信息, select indetity(int,9000000001,1) as xh,* into #temp from table ,int好象不行了
请教!!!!!!!!!!
问题点数:100、回复次数:3Top
1 楼CrazyFor(冬眠的鼹鼠)回复于 2003-01-03 12:56:13 得分 100
那改成bigint
再不行就用字符型呗
select identity(INT,1,1) as id,'9'+right('000000000'+cast(id as varchar(10)),9) as xh into #temp1 from sysobjects
select * from #temp1
Top
2 楼CrazyFor(冬眠的鼹鼠)回复于 2003-01-03 13:05:30 得分 0
更正:
drop table #temp1
select identity(INT,1,1) as iid into #temp1 from sysobjects
select '9'+right('000000000'+cast(id as varchar(10)),9) as xh from #temp
Top
3 楼KnowLittle(人傻不要紧,只要肯学习。)回复于 2003-01-03 13:08:32 得分 0
楼上的好快,:)
用numeric也可以
select identity(numeric,9000000001,1) as xh,* into #temp from tableTop




