110,529
社区成员
发帖
与我相关
我的任务
分享
Int64 value= Convert.ToInt64(Convert.ToInt32("123"));
declare @table table (colname varchar(32))
insert into @table
select '20198972201989722019897220198972' union all
select '20198972201989722019897220198973' union all
select '20198972201989722019897220198974' union all
select '20198972201989722019897220198975' union all
select '20198972201989722019897220198976' union all
select '20198972201989722019897220198977'
select * from @table
/*
colname
--------------------------------
20198972201989722019897220198972
20198972201989722019897220198973
20198972201989722019897220198974
20198972201989722019897220198975
20198972201989722019897220198976
20198972201989722019897220198977
*/
--得到其中最大的一个,转成int,然后+100,再存入表中
insert into @table
select cast(max(colname) as decimal(32,0))+100 from @table
--再看一下结果
select * from @table
/*
colname
--------------------------------
20198972201989722019897220198972
20198972201989722019897220198973
20198972201989722019897220198974
20198972201989722019897220198975
20198972201989722019897220198976
20198972201989722019897220198977
20198972201989722019897220199077
*/