Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSgetisvalidwindowsloginfromdistributor

  No additional text.


Syntax
CREATE PROCEDURE sys.sp_MSgetisvalidwindowsloginfromdistributor
(
	@login 		nvarchar(257),
	@isvalid	bit output,
	@publisher	sysname = NULL
)
AS
BEGIN
	SET NOCOUNT ON
	
	DECLARE @retcode 			int,
			@dbname 			sysname,
			@distproc			nvarchar(4000),
			@distributor_rpc	sysname,
			@distribution_db	sysname

	SELECT @isvalid = 0,
			@dbname = DB_NAME()
	
	-- if db is publisher we will reroute to distributor
	IF sys.fn_MSrepl_ispublished(@dbname) = 1
	BEGIN
		-- Security Check
	    EXEC @retcode = sys.sp_MSreplcheck_publish
	    IF @@ERROR <> 0 OR @retcode <> 0
	        RETURN 1

		-- retrieve the distributor db information
	    EXEC @retcode = sys.sp_helpdistributor @rpcsrvname = @distributor_rpc OUTPUT,
	    										@distribdb = @distribution_db OUTPUT,
	    										@publisher = @publisher
		IF @@ERROR <> 0 OR @retcode <> 0 OR @distributor_rpc IS NULL OR @distribution_db IS NULL
		BEGIN
			-- "The Distributor has not been installed correctly."
			RAISERROR (20036, 16, -1)
			RETURN 1
		END

		SELECT @distproc = QUOTENAME(@distributor_rpc) + '.' + QUOTENAME(@distribution_db) + '.sys.sp_MSgetisvalidwindowsloginfromdistributor'

		EXEC @retcode = @distproc @login = @login,
									@isvalid = @isvalid OUTPUT
		
		IF @@ERROR <> 0 OR @retcode <> 0
			RETURN 1
	END
	-- if we are at the distributor db then return the value
	ELSE IF sys.fn_MSrepl_isdistdb (@dbname) = 1
	BEGIN
		-- Security Check
	    IF IS_MEMBER('db_owner') != 1
	    BEGIN
	        RAISERROR(14260, 16, -1)
	        RETURN 1
	    END
	
		SELECT @isvalid = sys.fn_replisvalidwindowsloginformat(@login)
	END
	-- else raise an error
	ELSE
	BEGIN
		-- The database is not published.
		RAISERROR (18757, 16, -1)
		RETURN 1
	END

	RETURN 0
END

 
Last revision 2008RTM
See also

  sp_MSdrop_replcom (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