IF (SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TableName' AND COLUMN_NAME='columnName')>0
BEGIN
alter table Event ADD StoreAmount [int] NOT NULL DEFAULT 0
END
Wednesday, May 6, 2009
T-SQL判斷Table Column存不存在
Subscribe to:
Posts (Atom)