Wednesday, March 28, 2012

Having Problems enumerating publishers

Hi,
i want to enumerate all publishers from a sql server instance.
Sometimes it works and i get the publishers, sometimes not, i get an empty
queryresults-list with just the column - names.
I tried publisher and publisher2 object:
Syntax
object.EnumPublications( Database , ReplicationType , AgentLogin ,
bSecurityCheck) as QueryResults
e.g.:
dim queryres as queryresult
Dim serverpub As SQLDMO.SQLServer
Dim publisher2 As publisher2
Set publisher2 = serverpub.Replication.Publisher
Set queryres = publisher2.EnumPublications(SQLDMORepType_Transact ionalMerge,
"%", "", False)
sometimes queryres cotains publishers, sometimes not.
the same problem occures, using sp_MSenumallpublicastions in Queryanalyzer.
Is this a known problem?
What can i do?
Regards
Georg Notter
I am confused as to what you are trying to enumerate - publishers or
publications?
If you want to enumerate publishers use sp_helpdistpublisher @.check_user = 1
or this sqldmo snippet
set objSQLServer=CreateObject("SQLDMO.SQLServer")
objSQLServer.LoginSecure=True
objSQLServer.Connect "."
for each Publisher in
objSQLServer.Replication.Distributor.DistributionP ublishers
wscript.echo Publisher.Name
next
If you want to enumerate all publications I'd try this:
exec distribution..sp_MShelp_publication @.@.servername
or
set objSQLServer=CreateObject("SQLDMO.SQLServer")
objSQLServer.LoginSecure=True
objSQLServer.Connect "."
for each Publisher in
objSQLServer.Replication.Distributor.DistributionP ublishers
wscript.echo Publisher.Name
next
for each Publisher in
objSQLServer.Replication.Distributor.DistributionP ublishers
for each publication in Publisher.DistributionPublications
wscript.echo Publication.Name
next
next
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"georg notter" <georgnotter@.discussions.microsoft.com> wrote in message
news:ED795200-E450-4328-BF6F-384BBD8F2674@.microsoft.com...
> Hi,
> i want to enumerate all publishers from a sql server instance.
> Sometimes it works and i get the publishers, sometimes not, i get an empty
> queryresults-list with just the column - names.
> I tried publisher and publisher2 object:
> Syntax
> object.EnumPublications( Database , ReplicationType , AgentLogin ,
> bSecurityCheck) as QueryResults
>
> e.g.:
> dim queryres as queryresult
> Dim serverpub As SQLDMO.SQLServer
> Dim publisher2 As publisher2
> Set publisher2 = serverpub.Replication.Publisher
> Set queryres =
publisher2.EnumPublications(SQLDMORepType_Transact ionalMerge,
> "%", "", False)
> sometimes queryres cotains publishers, sometimes not.
> the same problem occures, using sp_MSenumallpublicastions in
Queryanalyzer.
> Is this a known problem?
> What can i do?
> Regards
> Georg Notter
>
sql

No comments:

Post a Comment