SELECT
'alter table ' + a.name + ' alter column ' + b.name +' ' + c.name + '(' + cast(b.length as char(6)) +' ) collate SQL_Latin1_General_CP1_CI_AI ' + case isnullable when 0 then 'not null' else '' end
FROM
syscolumns b,
sysobjects a,
systypes c
WHERE
b.id = a.id AND
a.id in (SELECT
id
FROM
sysobjects
WHERE
xtype='U'
) AND
b.xtype = c.xtype AND
c.name <> 'sysname' AND
b.xtype in (SELECT
xtype
FROM
systypes
WHERE
name in ('nvarchar','varchar','char','nchar')
)
阅读(3972) | 评论(0) | 转发(0) |