你的BZ字段是什么类型的?
在SQL SERVER系统表中可查询到所有含有BZ字段的表名。建一游标,做循环,动态写SQL语句,用ALPET TABLE。
但先的看你以前字段是什么?有可能会影响你以前的记录。

解决方案 »

  1.   

    create proc up_alterTable
    as
    begin
    declare @id int,@name varchar(256),@SQL varchar(40),@SQL1 varchar(40)
    select @SQL = 'alter table ',@SQL1 = ' alter column BZ varchar(256)'
    declare mycursor cursor for select id,name from sysobjects where xtype = 'U'
    open mycursor
    fetch mycursor into @id,@name
    while (@@fetch_status=0)
    begin
    if exists(select 1 from syscolumns where id = @id and name = 'BZ')
    exec (@SQL+@name+@SQL1)
    fetch mycursor into @id,@name
    end
    close mycursor
    DEALLOCATE mycursor
    end