从远程 SQL 服务器数据库 table 更新本地数据库 table
Update a local db table from remote SQL Server db table
我想要一个 远程数据库的本地副本 table,每 N 分钟更新一次。我如何使用 sql management studio(可能)完成此操作而无需自己构建脚本?
这是table
sql 服务器导入和导出向导似乎不适合我:事实上它不支持从 table 导入另一个新内容。
我写了一个简单的程序,用于将本地 table 与远程同步,仅包含新数据,具体取决于时间戳
create procedure p_sync_from_remote
as
begin
declare @lastitem Datetime =
(select top 1 Time_Stamp from table_destination order by Time_Stamp desc)
if (@lastitem is null) or (len(@lastitem) <= 0)
begin
insert into table_destination
select * from table_source
end
else
begin
insert into table_destination
select * from table_source where Time_Stamp > @lastitem
end
end
exec p_sync_from_remote
我想要一个 远程数据库的本地副本 table,每 N 分钟更新一次。我如何使用 sql management studio(可能)完成此操作而无需自己构建脚本?
这是table
sql 服务器导入和导出向导似乎不适合我:事实上它不支持从 table 导入另一个新内容。
我写了一个简单的程序,用于将本地 table 与远程同步,仅包含新数据,具体取决于时间戳
create procedure p_sync_from_remote
as
begin
declare @lastitem Datetime =
(select top 1 Time_Stamp from table_destination order by Time_Stamp desc)
if (@lastitem is null) or (len(@lastitem) <= 0)
begin
insert into table_destination
select * from table_source
end
else
begin
insert into table_destination
select * from table_source where Time_Stamp > @lastitem
end
end
exec p_sync_from_remote