declare @sql varchar(8000), @table sysname
select @table='table_name', @sql=''
select
@sql=@sql+'select '''+@table+''' as table_name,'''+column_name+''' as column_name,
max(len('+column_name+')) as column_length from '+@table+' union all '
from
information_schema.columns where table_name=''+@table+''
set @sql=left(@sql,len(@sql)-9)
exec(@sql)
No comments:
Post a Comment