Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created May 17, 2017 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksakae1216/076bd694d60a93df76e6de7f1ceffed2 to your computer and use it in GitHub Desktop.
Save ksakae1216/076bd694d60a93df76e6de7f1ceffed2 to your computer and use it in GitHub Desktop.
--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