用SQL语句实现这个功能:如果存在数据库A,则删除它
成功立马结贴

解决方案 »

  1.   

    if db_id(N'库名') is not null
        drop database 库名
      

  2.   

    if exists (select * from dbo.sysdatabases where name ='数据库A')
    drop database [数据库A]
      

  3.   

    1\ IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'数据库名称') 
    DROP DATABASE [数据库名称] 
    GO2\ exec sp_dbremove 数据库名
      

  4.   

    if db_id(N'库名') is not null
        drop database 库名
      

  5.   

    接分IF OBJECT_ID('DataBase-A') IS NOT NULL
    DROP DataBase  DataBase-A
      

  6.   

    if db_id('库名') is not null  
     drop database 库名