Trying to create replication on a SQL 2008 R2 database.
Can replicate all tables, views, and UDFs with "copy permissions" set to true with no issue.
If I try to replicate any stored procs which aren't in dbo schema the Generate Snapshot process fail with the error
Error messages:
Source: Microsoft.SqlServer.Replication
Target Site: Void Script()
Message: Object reference not set to an instance of an object.
Stack: at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.TextModeOnObjectScripter.Script()
at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.GenerateNonTableArticleSchScript(Scripter scripter, BaseArticleWrapper articleWrapper, SqlSmoObject smoObject, Boolean quotedIdentifierOn, Boolean ansiNullsOn, Boolean textMode)
at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.GenerateStoredProcedureArticleScripts(ArticleScriptingBundle articleScriptingBundle)
at Microsoft.SqlServer.Replication.Snapshot.TransSmoScriptingManager.GenerateArticleScripts(ArticleScriptingBundle articleScriptingBundle)
at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.GenerateObjectScripts(ArticleScriptingBundle articleScriptingBundle)
at Microsoft.SqlServer.Replication.Snapshot.SmoScriptingManager.DoScripting()
at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.DoScripting()
at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: Microsoft.SqlServer.Replication, Error number: 0)
Get help: http://help/0
An example of one of the stored procs is:
CREATE proc [TIMEZONE].[getDSTStartAndEndDate] (
@currentDate datetime
)
as
select DSTStart_LST, DSTEnd_LST
from [TIMEZONE].DSTStartEndDate
where Year = Year(@currentDate)
for XML AUTO
GO
The only permission being set is:
GRANT EXECUTE on [TIMEZONE].[getDSTStartAndEndDate] to [public];
All the users, schemas and tables exist at the destination. if the grant SQL is run on the destination it runs without error.