相关文章推荐
帅气的黑框眼镜  ·  Overview - ...·  1 年前    · 
健身的罐头  ·  GrADS ...·  1 年前    · 
淡定的梨子  ·  c# - Difference ...·  1 年前    · 
还单身的红金鱼  ·  python - Polars: ...·  1 年前    · 
鬼畜的水煮肉  ·  windows - Creating a ...·  1 年前    · 

1.字段是否存在

if((select count(*) from syscolumns where name = '字段名' and id=(select id from sysobjects where name='表名'))=0)
begin

2.表是否存在

if exists (select * from sysobjects where id = OBJECT_ID('表名') and OBJECTPROPERTY(id, 'IsUserTable') = 1)
DROP TABLE 表名