-- 判斷數(shù)據(jù)庫表是否存在select count(*) from sysobjects where id=OBJECT_ID('tableName');-- 返回 1存在,0不存在-- 判斷表字段是否存在select count(*) from syscolumns where id=OBJECT_ID('tableName') and name='colName';-- 返回1 存在,0不存在-- 判斷字段索引是否存在select count(*) from sys.indexes where name='indexName';-- 返回1存在,0不存在
新聞熱點
疑難解答
圖片精選