批量更改字段長度大小

2021-05-26 06:25:58 字數 601 閱讀 8741

create proc changecolumnlength

@p0 varchar(50)   --table name

asbegin

declare @column varchar(50),@sql varchar(max)

declare mycursor cursor for

select name from syscolumns where id=object_id(@p0) and xtype='167' and length between 1 and 50

open mycursor

fetch next from mycursor into @column

while(@@fetch_status=0)

begin

set @sql='alter table '+@p0+' alter column '+@column+' varchar(max) ' 

exec(@sql)

fetch next from mycursor into @column

endclose mycursor

deallocate mycursor

end

Oracle批量修改字段長度

查詢表中字段型別是str並且字段長度小於30的字段 select from sy serv item where serv id kszx ht and item field type str and item field length 30 將表中字段型別是str並且字段長度小於30的字段改為長度...

Mysql字段長度

列型別 需要的儲存量 tinyint 1 位元組 allint 2 個位元組 mediumint 3 個位元組 int 4 個位元組 integer 4 個位元組 bigint 8 個位元組 float x 4 如果 x 24 或 8 如果 25 x 53 float 4 個位元組 double 8...

一般mysql字段長度 Mysql字段長度

列型別 需要的儲存量 tinyint 1 位元組smallint 2 個位元組mediumint 3 個位元組int 4 個位元組integer 4 個位元組bigint 8 個位元組float x 4 如果 x 列型別 需要的儲存量 tinyint 1 位元組 smallint 2 個位元組 me...