Hi All,I'm trying to experiment with Nonpartitioned, Bidirectional, Transactional Replication and I've copy and pasted the Microsoft sample script from here [url]http://msdn.microsoft.com/en-us/library/ms147929.aspx[/url]. However, it seems to have some kind of syntax error which I can't find. Specifically;Msg 102, Level 15, State 1, Line 23Incorrect syntax near ','.
By commenting out parts of the script I've narrowed it down to the following snippet;USE test1GODECLARE @publication AS sysname;DECLARE @subscriber AS sysname;DECLARE @subscription_db AS sysname;SET @publication = N'two_way_pub_test1';SET @subscriber = $(SubServer2);SET @subscription_db = N'test2';/*EXEC sp_addsubscription @publication = @publication, @article = N'all', @subscriber = @subscriber, @destination_db = @subscription_db, @sync_type = N'none', @status = N'active', @update_mode = N'read only', @loopback_detection = 'true';*/EXEC sp_addpushsubscription_agent @publication = @publication, @subscriber = @subscriber, @subscriber_db = @subscription_db, @subscriber_security_mode = 0, @subscriber_login = $(Login), @subscriber_password = $(Password);GO
I had to modify the script slightly to set the security mode to 0 and replace the "job_login" with "subscriber_login" because I'm using SQL Server authentication.The only thing that is different with running the script this time is how I've defined the variable "SubServer2", namely;:setvar SubServer2 @@ServerName
I'm running the query in Management Studio with the query in SQLCMD Mode. I can't see anything wrong with the above though. To make matters worse, this is not my first experiment with this particular script, I have had it working before.I'm running SQL Server 2008 R2 on a Windows Server 2008.Can anyone help me shed some light on this?Many thanks,Tom