我们可以为 SQL Server 和 Azure SQL DB 之间的插入、更新和删除构建跨数据库查询吗?反之亦然?
主页
/
user-219016
Sarvesh Pandey's questions
Sarvesh Pandey
Asked:
2020-12-01 10:03:44 +0800 CST
我们正在尝试运行以下查询。
DECLARE @CounterNumber INT = 1
WHILE @CounterNumber <= 3
BEGIN
Declare @name varchar(255)
Set @name = (Select Name from TableList where id = @CounterNumber)
SELECT CHANGE_TRACKING_CURRENT_VERSION() as CurrentChangeTrackingVersion
SELECT SYS_CHANGE_VERSION FROM [dbo].[table_store_ChangeTracking_version] WHERE TableName = @name
DECLARE @sql NVARCHAR(MAX);
DECLARE @currentVersion bigint
Set @currentVersion = (SELECT TOP 1 SYS_CHANGE_VERSION FROM table_store_ChangeTracking_version WHERE TableName=@name)
DECLARE @newVersion bigint = CHANGE_TRACKING_CURRENT_VERSION()
SET @sql = 'SELECT
Ct.sys_change_Operation,
CT.sys_change_version,
CT.id as ct_id,
@name.*
FROM @name
RIGHT OUTER JOIN CHANGETABLE(CHANGES dbo.@name, @currentVersion) CT ON @name.Id = CT.Id'
SET @sql = REPLACE(@sql, '@name', quotename(@name))
EXEC sp_executesql @sql
set @CounterNumber = @CounterNumber + 1
END;
但是我们收到错误说明:
必须声明标量变量“@currentVersion”。
谁能帮我理解我们这里出了什么问题?
Sarvesh Pandey
Asked:
2020-11-21 06:29:46 +0800 CST
我有 SQL Server Enterprise Edition 的软件保障,我需要在上面设置高可用性。
问题是我的主 SQL Server 具有标准许可证。
我可以将 SQL Server 企业版添加为辅助副本吗?