Skip to content

Instantly share code, notes, and snippets.

@ksakae1216 ksakae1216/sql2
Created May 17, 2017

Embed
What would you like to do?
--2.次に全カラムの設定変更
select
'ALTER TABLE '
+ so.name
+ ' ALTER COLUMN '
+ sc.name
+ ' '
+ st.name
+ '('
+ convert(varchar,sc.length)
+ ') COLLATE Japanese_CS_AS_KS_WS '
+ case when sc.isnullable = 0 then 'NOT NULL' else '' end as "全カラムの設定変更"
from sysobjects so
join syscolumns sc on so.id=sc.id
join systypes st on sc.xtype=st.xtype
where so.type='U'
and so.name like 'TEST_%'
and st.name in ('char', 'varchar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.