create procedure sys.sp_MSgettranconflictname (
@publication sysname,
@source_object nvarchar(540),
@str_prefix nvarchar(30) = NULL,
@conflict_table sysname = NULL OUTPUT)
AS
begin
declare @objid int
declare @retcode int
declare @object_name sysname
declare @name_out sysname
declare @pubid int
declare @article sysname
declare @artid int
declare @prefixlen int
if (@str_prefix is NULL)
select @str_prefix = 'conflict_'
select @prefixlen = len(@str_prefix)
select @pubid=pubid from syspublications
where name=@publication
select @objid = object_id(@source_object)
select @artid = artid, @article=name from sysarticles
where objid = @objid and pubid=@pubid
if len(@publication) + len(@article) > 128 - @prefixlen -1 -- sysname minus prefix len
begin
select @object_name = @str_prefix +
convert(nvarchar(59), @publication) +
'_' + convert(nvarchar(59), @article)
end
else
begin
select @object_name = @str_prefix + @publication + '_' + @article
end
select @conflict_table = @object_name
exec @retcode = sys.sp_MSuniqueobjectname @object_name, @conflict_table OUTPUT
end