January 9, 2003 at 3:53 pm
I could definitely write up something for a case study if you like. Once everything is finished I'll let you know.
I'm still working through the Replication parts. I can't decide if I should just remove all the tables, or if there is a way for me to figure out if the table (in a for each...next statement) exists in the replications already.
January 9, 2003 at 5:00 pm
No reason you can't do a for/each loop to check to see which tables are already in the pub.
Andy
January 9, 2003 at 5:11 pm
Yeah the problem was knowing what table i was curently working with, here's what I am doing for it, worked pretty well.
Function Main()
Dim oRDB 'As SQLDMO.ReplicationDatabase
Dim oDb 'As SQLDMO.Database
Dim oPub 'As SQLDMO.MergePublication
Dim oArticle 'As SQLDMO.MergeArticle
'create standard server object first
Set oserver = CreateObject("SQLDMO.SQLServer")
With oserver
.LoginSecure = True
.Connect "SQLVS01\SQLVS01"
End With
set oDB = oserver.Databases("DTS_Store")
'get this to be a little closer to where we will do the work
Set oRDB = oserver.Replication.ReplicationDatabases("DTS_Store")
'pub normally has same name as db, doesn't have to though
Set oPub = oRDB.MergePublications("DTS_Store")
For Each oTbl in oDB.Tables
strTblName = oTbl.Name
strSql = "Select * From sysmergearticles Where [name] = '" & strTblName & "'"
set oResults = oserver.Databases("DTS_Store", "dbo").ExecuteWithResults(strSQL)
if oResults.Rows = 0 And oTbl.SystemObject = False then
'table is not a merge article need to add it
'create the article
Set oArticle = CreateObject("SQLDMO.MergeArticle")
With oArticle
.Name = strTblName
.SourceObjectName = strTblName
.SourceObjectOwner = "dbo"
End With
'add it to the collection
oPub.MergeArticles.Add oArticle
'clean up
Set oArticle = Nothing
End If
Next
'clean up
Set oPub = Nothing
Set oRDB = Nothing
oserver.DisConnect
Set oserver = Nothing
Main = DTSTaskExecResult_Success
End Function
January 9, 2003 at 7:03 pm
GRRR...
I'm at my wits end with this, plus im getting very hungry. Anyway so far I can't find any documentation online about programming the snapshot generation. So far I am reinitializing and resyncing all my subscriptions (at this point 1) of course, that's not doing a thing for the replication. I just can't seem to find any info on creating a new snapshot, is there a sproc i need?
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply