通过一些数据转换创建 Sql 服务器复制(期间或结束时)
我正在运行 SQL Server 复制以将表同步到单独的(报告)数据库。
在源数据库中,所有记录都有一个 DateTime
值(并不罕见),但它不是存储为 DateTime
,而是存储为 Guid
>... 指向包含所有时间戳的表(每分钟一个)。
现在我想做的是在复制过程中(或在结束时,或在目标数据库中连续)查找时间戳数据库中的时间戳(在 datetime
值中)并填写一个额外的字段在目标数据库中使用该 DateTime
值。
原因是我可以在特定日期时间查询目标数据库,而无需将其加入时间戳数据库。
这可能吗?
我将“DTS”属性视为复制的属性,这让我认为我可以以某种方式指定 DTS 包,但该属性未启用,并且我认为 DTS 已被弃用?
i'm running a sql server replication to sync a table to a separate (reporting) database.
In the source database, all records have a DateTime
value (not so unusual) but it isn't stored as a DateTime
, but as a Guid
... which points to a table which contains all timestamps (one for every minute).
Now what i would like to do is during the replication process (or at the end, or continuous at the target database) is lookup the timestamp (in datetime
value) in the TimeStamps database and fill an extra field in the target database with that DateTime
value.
The reason for that is that i can query the target database on specific datetimes without having to join it to the timestamps database.
Is this possible?
I've seen as a property of the replication a 'DTS' property, which makes me think i can somehow specify a DTS package, but the property isn't enabled and i thought DTS is deprecated?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设事务复制,我将在订阅者上自定义
sp_MSins_YourTable
和sp_MSupd_YourTable
存储过程来执行额外的查找/翻译。请务必完整记录此自定义,因为任何时候您必须删除/重新创建复制,您的自定义过程将再次被标准过程替换。Assuming a transactional replication, I would customize the
sp_MSins_YourTable
andsp_MSupd_YourTable
stored procedures on the subscriber to do the extra lookup/translation. Just be sure to fully document this customization as any time you would have to drop/recreate replication your custom procs will be replaced with the standard ones again.