Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSdrop_object

  No additional text.


Syntax
create procedure sys.sp_MSdrop_object
(
        @object_id int = NULL,
        @object_name sysname = NULL,
        @object_owner sysname = NULL
)
AS
begin
    SET NOCOUNT ON

    declare @cmd nvarchar(1000)

    if @object_name is not null
    begin
        declare @owner_id int
        if @object_owner is null
            select @owner_id = schema_id()
        else
            select @owner_id = schema_id(@object_owner)
        select @object_id = object_id
        from sys.objects
        where
            name = @object_name and
            schema_id = @owner_id
       end

       if @object_id is not null
       begin
           exec sys.sp_MSget_qualified_name @object_id, @cmd output
           if objectproperty(@object_id, 'IsTable') = 1
               select @cmd = 'drop table ' + @cmd
           else if objectproperty(@object_id, 'IsProcedure') = 1
               select @cmd = 'drop procedure ' + @cmd
           else if objectproperty(@object_id, 'IsTrigger') = 1
               select @cmd = 'drop trigger ' + @cmd
           else if objectproperty(@object_id, 'IsView') = 1
               select @cmd = 'drop view ' + @cmd
           else if objectproperty(@object_id, 'IsReplProc') = 1
               select @cmd = 'drop procedure ' + @cmd
           else
               select @cmd = null

           exec (@cmd)
           if @@error <> 0
               return(1)
       end
end

 
Last revision 2008RTM
See also

  sp_addsynctriggers (Procedure)
sp_articlesynctranprocs (Procedure)
sp_MSdrop_synctran_objects (Procedure)
sp_MSrepl_droparticle (Procedure)
sp_subscription_cleanup (Procedure)
sp_unlink_publication (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash