--判断数据库是否存在 IF EXISTS (SELECT * FROM MASTER.sys.sysdatabases WHERE NAME = '库名') PRINT 'exists ' else PRINT 'not exists' -- 判断要创建的表名是否存在 IF EXISTS (Select * From sysObjects Where Name ='表名' And Type In ('S','U')) PRINT 'exists' ELSE PRINT 'not exists'…