/***************************************************************************/
/* UNADMIN.SQL - Uninstall SQL Server SQL Administrator Stored Procedures  */
/***************************************************************************/
/* This stored procedure drops all stored procedures and tables            */
/* for the SQL Server Admin tool.                                          */
/***************************************************************************/
/* latest revision - 3/16/93                                               */
/* Copyright (C) 1993 - Microsoft Corporation                              */
/***************************************************************************/
print ''
print 'un-installing SQL Server SQL Administrator Scripts'
go


use master
go

/* */
/* Drop procedures */
/* */

if exists (select * from sysobjects where name = 'sp_MSdevice_list' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdevice_list
end

if exists (select * from sysobjects where name = 'sp_MSdev_description' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdev_description
end

if exists (select * from sysobjects where name = 'sp_MSdev_databases' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdev_databases
end

if exists (select * from sysobjects where name = 'sp_MSsys_monitor' and sysstat & 7 = 4)
begin
  drop procedure sp_MSsys_monitor
end

if exists (select * from sysobjects where name = 'sp_MSnext_devnumber' and sysstat & 7 = 4)
begin
  drop procedure sp_MSnext_devnumber
end

if exists (select * from sysobjects where name = 'sp_MSdatabase_list' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdatabase_list
end

if exists (select * from sysobjects where name = 'sp_MSdatabase_avail' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdatabase_avail
end

if exists (select * from sysobjects where name = 'sp_MSbackup_now' and sysstat & 7 = 4)
begin
  drop procedure sp_MSbackup_now
end

if exists (select * from sysobjects where name = 'sp_MSuser_list' and sysstat & 7 = 4)
begin
  drop procedure sp_MSuser_list
end

if exists (select * from sysobjects where name = 'sp_MSmonitor' and sysstat & 7 = 4)
begin
  drop procedure sp_MSmonitor
end

if exists (select * from sysobjects where name = 'sp_MSdb_devices' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdb_devices
end

if exists (select * from sysobjects where name = 'sp_MSdb_options' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdb_options
end

if exists (select * from sysobjects where name = 'sp_MSdb_properties' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdb_properties
end

if exists (select * from sysobjects where name = 'sp_MSdb_space' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdb_space
end

if exists (select * from sysobjects where name = 'sp_MSbackup_schedule' and sysstat & 7 = 4)
begin
  drop procedure sp_MSbackup_schedule
end

if exists (select * from sysobjects where name = 'sp_MScmd_permissions' and sysstat & 7 = 4)
begin
  drop procedure sp_MScmd_permissions
end

if exists (select * from sysobjects where name = 'sp_MSuser_cmd_permissions' and sysstat & 7 = 4)
begin
  drop procedure sp_MSuser_cmd_permissions
end

if exists (select * from sysobjects where name = 'sp_MScheck_admin' and sysstat & 7 = 4)
begin
  drop procedure sp_MScheck_admin
end

if exists (select * from sysobjects where name = 'sp_MSdb_options_bits' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdb_options_bits
end

if exists (select * from sysobjects where name = 'sp_MSAdmin_version' and sysstat & 7 = 4)
begin
  drop procedure sp_MSAdmin_version
end
go

print ''
go
/* */
/* these are 4.2 only */
/* */

if exists (select * from sysobjects where name = 'sp_MSdev_mirror' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdev_mirror
end

if exists (select * from sysobjects where name = 'sp_MSdb_devices_segments' and sysstat & 7 = 4)
begin
  drop procedure sp_MSdb_devices_segments
end

if exists (select * from sysobjects where name = 'sp_MSsegment_list' and sysstat & 7 = 4)
begin
  drop procedure sp_MSsegment_list
end

if exists (select * from master.dbo.sysobjects where name = 'sp_MSsegment_devices' and sysstat & 7 = 4)
begin
  drop procedure sp_MSsegment_devices
end

if exists (select * from sysobjects where name = 'sp_MSseg_properties' and sysstat & 7 = 4)
begin
  drop procedure sp_MSseg_properties
end

if exists (select * from master.dbo.sysobjects where name = 'sp_MSseg_tables' and sysstat & 7 = 4)
begin
  drop procedure sp_MSseg_tables
end

if exists (select * from sysobjects where name = 'sp_MSthread_list' and sysstat & 7 = 4)
begin
  drop procedure sp_MSthread_list
end

if exists (select * from sysobjects where name = 'sp_MShelpdb' and sysstat & 7 = 4)
begin
  drop procedure sp_MShelpdb
end
if exists (select * from sysobjects where name = 'sp_MShelpremotelogin' and sysstat & 7 = 4)
begin
  drop procedure sp_MShelpremotelogin
end
if exists (select * from sysobjects where name = 'sp_MShelpserver' and sysstat & 7 = 4)
begin
  drop procedure sp_MShelpserver
end

if exists (select * from sysobjects where name = 'sp_MSlogdevice' and sysstat & 7 = 4)
begin
  drop procedure sp_MSlogdevice
end


/* */
/* Drop the tables */
/* */
print ''
go

if exists (select * from sysobjects where name = 'MSsystem_monitor')
begin
  drop table MSsystem_monitor
end

if exists (select * from sysobjects where name = 'MSlast_monitor')
begin
  drop table MSlast_monitor
end

go
