Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSget_publication_from_taskname

  No additional text.


Syntax
create procedure sys.sp_MSget_publication_from_taskname
    @taskname     sysname,
    @publisher    sysname,
    @publisherdb  sysname,
    @publication  sysname OUTPUT
as
    declare @value       sysname
    declare @value2      sysname
    declare @position    INT

    select @publication = NULL

    -- Security check: sysadmin only
    if (isnull(is_srvrolemember('sysadmin'),0) = 0)
    begin
        raiserror(21089,16,-1)
        return 1
    end

    -- Parse out publication name from the task name "publisher_publisherdb_publication_number"
    -- Expect publisher name
    if charindex(@publisher, @taskname) <> 1
    begin
        return 1
    end

    -- Eat up the publisher name
    select @value = stuff(@taskname, 1, len(@publisher), N'')

    -- Expect '_' + publisherdb + '_'
    select @value2 = N'_' + @publisherdb + N'_'
    if charindex(@value2, @value) <> 1
    begin
        return 1
    end

    -- Eat up '_' + publisherdb + '_'
    select  @value = stuff(@value, 1, LEN(@publisherdb) + 2, N'')

    -- Reverse the string in the hope of finding the first '_'
    -- from the right which denotes the end of the publication
    -- name. The number at the end should not contain '_'
    select @value2 = reverse(@value)
    select @position = charindex(N'_', @value2)
    if @position < 2
    begin
        return 1
    end

    select @publication = left(@value, len(@value) - @position)
    return 0

 
Last revision 2008RTM
See also

  sp_addtask (Procedure)
sp_MSfix_6x_tasks (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