use master
select * from sysdevices

解决方案 »

  1.   

    if exists(select * from sysdevices where name='yourDeviceName')
    begin
       print '备份设备存在'
    end
    else
    print '备份设备不存在''
      

  2.   

    if exists(select 1 from master..sysdevices where name='你的备份设备名')
      print '在'
    else 
      print '不在'
      

  3.   

    sysdevices
    每个磁盘备份文件、磁带备份文件和数据库文件在表中占一行。该表只存储在 master 数据库中。重要  该系统表提供向后兼容信息。在 Microsoft® SQL Server™ 的早期版本中,该表包含所有数据库文件的列表。在 SQL Server 7.0 版中,数据库文件列表存储在每个数据库的 sysfiles 系统表中。
    列名 数据类型 描述 
    name sysname 备份文件或数据库文件的逻辑名称。 
    size int 以两千字节 (KB) 页为单位的文件大小。 
    low int 维护该列只是为了向后兼容。 
    high int 维护该列只是为了向后兼容。 
    status smallint 表示设备类型的位图: 
    1 = 默认磁盘 
    2 = 物理磁盘 
    4 = 逻辑磁盘
    8 = 跳过首部
    16 = 备份文件
    32 = 串行写入
    4096 = 只读
     
    cntrltype smallint 控制器类型: 
    0 = 非光盘数据库文件
    2 = 磁盘备份文件
    3 - 4 = 磁盘/软盘备份文件
    5 = 磁带备份文件
    6 = 命名管道文件
     
    phyname nvarchar(260) 物理文件名。 
      

  4.   

    同意ligg
    use master
    if exists(select * from sysdevices where name='yourDeviceName')
    begin
       print '备份设备存在'
    end
    else
    print '备份设备不存在''
      

  5.   

    执行 select * from sysdevices where name='yourDeviceName'如果返回的记录集中记录条数〈1,则不存在,否则存在
      

  6.   

    execute sp_helpdevice '设备名称'
    orif exists(select * from master..sysdevices where name='设备名称')
    print 'exist'
    else
    print 'not exist'
      

  7.   

    --程序中可以这样判断:用ado.recordset,打开
    select * from master..sysdevices where name='设备名称'如果返回的记录数为0,说明没有,否则表示有