As mentioned in the title, I have been trying to include the non-clustered index on my transactional replication.
When I created the publication, I have checked the option for "copy nonclustered index" in the [Set properties for all table articles]
But after I finished creating the publication, when I check the publication properties again, the option for "copy nonclustered index" is changed to the default of false
. No matter how many times I tried to change it, it won't change.
My next try was to delete my VM and re-create the VM from the scratch. but it still won't allow me to copy the nonclustered index.
So then, I was thinking that maybe it was a bug with the SQL Server version that I'm using in my VM. So I tried to copy the whole database into my localhost, and the problem still occurs
- My VM SQL Server edition: SQL Server 2012 Standard edition
- My localhost edition : SQL Server 2019 Developer edition
Eventually I found someone said that
With the following code: the stored procedure in the snapshot will failed to be applied:
CREATE NONCLUSTERED INDEX [IX_TestTable] ON [dbo].#TestTable
But, changing the syntax slightly causes the stored procedure to create without issue:
ALTER TABLE dbo.#TestTable ADD CONSTRAINT IX_TestTable UNIQUE NONCLUSTERED ( ID )
But I can't afford to change my index / recreate my index in my production environment. Is there any solution for this?
- Update
what I'm trying to replicate is my whole database. including all of my tables and store procedures. so my tables are not temp table