临时

IF NOT EXISTS (SELECT 1 FROM SYS.columns WHERE object_id = OBJECT_ID('User_Mac_Info') AND name = 'user_department_id') /部门/
BEGIN
ALTER TABLE User_Mac_Info ADD user_department_id INT DEFAULT 0
END

IF NOT EXISTS (SELECT 1 FROM SYS.columns WHERE object_id = OBJECT_ID('User_Mac_Info') AND name = 'area_code') /机构编号/
BEGIN
ALTER TABLE User_Mac_Info ADD area_code varchar(255) DEFAULT ''
END
IF NOT EXISTS (SELECT 1 FROM SYS.columns WHERE object_id = OBJECT_ID('User_Mac_Info') AND name = 'area_name') /机构编号/
BEGIN
ALTER TABLE User_Mac_Info ADD area_name varchar(255) DEFAULT ''
END
IF NOT EXISTS (SELECT 1 FROM SYS.columns WHERE object_id = OBJECT_ID('User_Mac_Info') AND name = 'log_limit')
BEGIN
ALTER TABLE User_Mac_Info ADD log_limit int default 0
END
IF NOT EXISTS (SELECT 1 FROM SYS.columns WHERE object_id = OBJECT_ID('User_Mac_Info') AND name = 'log_user')
BEGIN
ALTER TABLE User_Mac_Info ADD log_user text default('')
END
IF NOT EXISTS (SELECT 1 FROM SYS.columns WHERE object_id = OBJECT_ID('User_Mac_Info') AND name = 'region_select')
BEGIN
ALTER TABLE User_Mac_Info ADD region_select int default 1;
END
IF EXISTS (SELECT 1 FROM SYS.columns WHERE object_id = OBJECT_ID('User_Mac_Info') AND name = 'region_select')
BEGIN
update User_Mac_Info set region_select=1;
END

你可能感兴趣的:(临时)