Judge whether a column exists in a table
2006-06-08 12:28
267 查看
if not exists( select 1 from dbo.syscolumns s
where name ='yourColumn'
and id = object_id(N'YourTable'))
begin
alter table YourTable add yourColumn ColumnType
end
where name ='yourColumn'
and id = object_id(N'YourTable'))
begin
alter table YourTable add yourColumn ColumnType
end
相关文章推荐
- add column for a table if this column not exists using T-SQL in SQLServer
- Judge whether the user is in some windows group.
- MySQL - EF : The value for column 'IsPrimaryKey' in table 'TableDetails' is DBNull
- 【MySQL笔记】解除输入的安全模式,Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect.
- 75.The following data exists in the PRODUCTS table:
- Cannot insert explicit value for identity column in table 'settings' when IDENTITY_INSERT is set to OFF.
- Refreshing One Column based on the value of Another Column in ADFdi Table
- Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAUL
- rror Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnec
- 3.You need to extract details of those products in the SALES table where the PROD_ID column contains
- Cannot insert explicit value for identity column in table 'settings' when IDENTITY_INSERT is set to OFF.
- rails reverse words you can't use them in as your column or tablename
- “DROP TABLE IF EXISTS” in Oracle and SQL Server
- An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON
- InnoDB: 2 of name './banggood201401/ana_tmp_sku.ibd' already exists in the tablespace
- Cannot insert explicit value for identity column in table ‘table’ when IDENTITY_INSERT is set to OFF
- 82.Examine the data in the CUST_NAME column of the CUSTOMERS table.
- MySQL How to add a column in a table?
- JBOSS多实例部署出现Table already exists: JMS_MESSAGES in statement[更新]
- ADF - Groovy for Total Sum of a Column in a Table - adf表格加合计