MSSQL-DDL
719 ワード
共通データベース定義言語DDL
--1.
select * from
SysObjects a left join SysColumns b on a.id = b.id
where a.name = 'TableName' and b.Name='ColumnName'
--2.
alter table TableName add ColumnName varchar(100) default ('') with values
--3.
alter table TableName drop column ColumnName
--4.
alter table TableName alter column ColumnName new_data_type
--5.
select b.name from syscolumns a,sysobjects b where a.id=object_id('TableName')
and b.id=a.cdefault and a.name='IsCanceled' and b.xtype='D'
if @defaultName is not null
--6.
alter table TableName drop constraint DefaultName