技术学习

我所喜欢的

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
--drop table #tmp_table

SELECT name into #tmp_table FROM SysObjects Where XType='U' 
declare @table nvarchar(50)
while exists (select top 1 * from #tmp_table)
BEGIN
    select top 1 @table = name from #tmp_table
    if Exists (SELECT * FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME=@table and COLUMN_NAME='SyncError')
    BEGIN
        declare @SQL NVARCHAR(200)= 'ALTER TABLE ' + @table +
        ' ALTER COLUMN SyncError NVARCHAR(MAX);'
        exec(@sql)

    END
    delete from #tmp_table where name=@table

END

 

posted on 2025-12-17 09:46  飘扬De黑夜  阅读(1)  评论(0)    收藏  举报