drop table #a

select identity(int,1,1) as Id, table_name, column_name, Is_Nullable, Data_Type
into #a
from INFORMATION_SCHEMA.COLUMNS where column_name='ModelID' and Data_Type<>'Bigint'

select * from #a

declare @Id int
declare @table nvarchar(50)
declare @column nvarchar(50)
declare @is_nullable nvarchar(50)
set @Id=1

while @Id<=(select max(id) from #a)
begin
 set @table=(select table_name from #a where id=@id)
 set @column=(select column_name from #a where id=@id)
 set @is_nullable=case when (select is_nullable from #a where id=@id)='No' then 'not null' else '' end;
print @table
print @column
print @is_nullable
 alter table @table alter @column Bigint @is_nullable
 set @id=@id+1
 continue
end

相关文章:

  • 2021-11-01
  • 2021-07-16
  • 2021-07-04
  • 2021-06-22
  • 2021-10-22
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
猜你喜欢
  • 2021-08-18
  • 2021-12-08
  • 2021-10-03
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-09-10
相关资源
相似解决方案