Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSprofile_in_use

  No additional text.


Syntax
CREATE PROCEDURE sys.sp_MSprofile_in_use
(
    @tablename          nvarchar(255),
    @profile_id int
)
AS
begin
    DECLARE @usage_count int

    
    -- security check
    -- only db_owner can execute this
    
    if (is_member ('db_owner') != 1)
    begin
        raiserror(14260, 16, -1)
        return (1)
    end

    IF @tablename IS NULL OR @profile_id IS NULL
        return 1 ;

    IF @tablename = 'MSsnapshot_agents'
        SELECT @usage_count = count(*) FROM MSsnapshot_agents
        WHERE profile_id = @profile_id
    ELSE IF @tablename = 'MSlogreader_agents'
            SELECT @usage_count = count(*) FROM MSlogreader_agents
            WHERE profile_id = @profile_id
        ELSE IF @tablename = 'MSdistribution_agents'
                SELECT @usage_count = count(*) FROM MSdistribution_agents
                WHERE profile_id = @profile_id
            ELSE IF @tablename = 'MSmerge_agents'
                    SELECT @usage_count = count(*) FROM dbo.MSmerge_agents
                    WHERE profile_id = @profile_id
                ELSE
                    SELECT @usage_count = 0

    IF @usage_count = 0
        RETURN -1
    ELSE
        RETURN 0
end

 
Last revision 2008RTM
See also

  sp_drop_agent_profile (Procedure)
sp_instdist (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