Parameterized ALTER TABLE statement to switch a partition may fail for a database that is published for transactional replication in SQL Server 2012 - by Alexey Knyazev

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 774508 Comments
Status Closed Workarounds
Type Bug Repros 4
Opened 12/16/2012 9:29:00 PM
Access Restriction Public


1: SQL Server 2008 and UP (2008, 2008R2, 2012)
2: database enabled for transactional publication
3: table with multiple partitions
4: Parameterized ALTER TABLE statement to switch a partition
Sign in to post a comment.
Posted by DWalker on 10/23/2013 at 11:10 AM
It's too bad that the actual error message ("must declare the scalar variable") is incorrect -- the scalar variable is properly declared. I wasted time due to this incorrect and misleading error message.

It would help the users if the error message could get fixed to accurately state the actual problem (something like "cannot pass a parameter to an Alter Table Switch Partition statement when the database is published for transactional replication").
Posted by DWalker on 10/23/2013 at 11:07 AM
I know that there is a workaround using dynamic SQL with Exec... BUT, 1) Will this ever get fixed? 2) Is it fixed in SQL 2012 or SQL 2014? I don't have those installed yet to test. Thanks.

David Walker
Posted by Jean-Yves [MSFT] on 1/4/2013 at 4:34 PM
Hi Alexey Knyazev ,
thanks for taking the time to share your feedback, this is really important to us.
We will investigate the issue and get back to you.

Best regards
Jean-Yves Devant 
Program Manager Servicing and Lifecycle Experience of High Availability Technologies in SQL Server