Sql-Server-2008-R2

以 sp_MSdel<TableName>、sp_MSins<TableName>、sp_MSupd<TableName> 為前綴的儲存過程

  • February 3, 2020

我注意到在數據庫中我管理著一堆以 sp_MSdel、sp_MSins 和 sp_MSupd 為前綴的刪除、插入、更新儲存過程。

有誰知道創建這些儲存過程的工具是什麼?

這是更新儲存過程的原始碼(我替換了表名和欄位名):

create procedure [dbo].[sp_MSupd_dboTableName]
       @c1 int = NULL,
       @c2 nvarchar(50) = NULL,
       @c3 nvarchar(50) = NULL,
       @c4 nvarchar(50) = NULL,
       @c5 nvarchar(50) = NULL,
       @c6 datetime = NULL,
       @c7 datetime = NULL,
       @pkc1 int = NULL,
       @bitmap binary(1)
as
begin  
update [dbo].[TableName] set
       [field2] = case substring(@bitmap,1,1) & 2 when 2 then @c2 else [Rid] end,
       [field3] = case substring(@bitmap,1,1) & 4 when 4 then @c3 else [Pid] end,
       [field4] = case substring(@bitmap,1,1) & 8 when 8 then @c4 else [AdUsername] end,
       [field5] = case substring(@bitmap,1,1) & 16 when 16 then @c5 else [FhaEmployeeID] end,
       [field6] = case substring(@bitmap,1,1) & 32 when 32 then @c6 else [AdAccountsRegisteredTimestamp] end,
       [field7] = case substring(@bitmap,1,1) & 64 when 64 then @c7 else [EmployeeIdsRegisteredTimestamp] end
where [id] = @pkc1
if @@rowcount = 0
   if @@microsoftversion&gt;0x07320000
       exec sp_MSreplraiserror 20598
end
GO

這些過程是在為數據庫中的表配置 SQL Server 複製(事務複製)時創建的。有關更多資訊,請參閱此連結

引用自:https://dba.stackexchange.com/questions/258662