0

I noticed in the database I manage a bunch of stored procedures for delete, insert, update prefixed with sp_MSdel, sp_MSins and sp_MSupd.

Does anyone know what tool creates these stored procedures?

Here is the source code of the update stored procedure (I replaced the table name and the field names):

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>0x07320000
        exec sp_MSreplraiserror 20598
end
GO

  • 4
    Replication creates those from what I recall – Aaron Feb 1 at 2:22
1

Those procedures are created when SQL Server Replication (Transactional Replication) is configured for a table in the database. See this link for more info.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.