Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_recompile

  No additional text.


Syntax
create procedure sys.sp_recompile
    @objname	 	nvarchar(776)
as
    -- do sets and declares
    Set nocount on
    declare @objid      int

	BEGIN TRANSACTION
    -- CHECK VALIDITY OF OBJECT NAME 
    --  (1) Must exist in current database
    --  (2) Must be a table or an executable object
    select @objid = object_id(@objname, 'local')

        if @objid is null OR
            (ObjectProperty(@objid, 'IsTable') = 0 AND
             ObjectProperty(@objid, 'IsExecuted') = 0)
        begin
	        COMMIT TRANSACTION
	        raiserror(15165,-1,-1 ,@objname)
	        return @@error
        end

	if not (@objid is null)
	begin
	    -- LOCK, CHECK PERMISSION, BUMP SCHEMA FOR RECOMPILE  
		EXEC %%Object(MultiName = @objname).LockMatchID(ID = @objid, Exclusive = 1, BindInternal = 0)
		if @@error <> 0
		begin
			COMMIT TRANSACTION
			raiserror(15165,-1,-1 ,@objname)
	        return @@error
		end
	end
		
	COMMIT TRANSACTION
	raiserror(15070,-1,-1,@objname)
	return (0) -- sp_recompile

 
Last revision 2008RTM
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