场景:
在数据库上有触发器(该触发器由复制发布产生)
create trigger [tr_MStran_altertable] on database for ALTER_TABLE as
set ANSI_NULLS ON
set ANSI_PADDING ON
set ANSI_WARNINGS ON
set ARITHABORT ON
set CONCAT_NULL_YIELDS_NULL ON
set NUMERIC_ROUNDABORT OFF
set QUOTED_IDENTIFIER ON
declare @EventData xml
set @EventData=EventData()
exec sys.sp_MStran_ddlrepl @EventData, 1
在该数据库上使用ALTER TABLE SWITCH时,如果ALTER TABLE 语句带有变量,会报运行时错误,提示变量无效。