if db_id(N'test') is not null -- db_id(N'test') 根据名称获取数据库ID, drop database test go 如果数据库存在,则drop掉数据库。