Added code to update FloatingFoldout ItemID value when copying a procedure which contains FloatingFoldout data.
This commit is contained in:
parent
aa6050a955
commit
d6aae18a46
@ -9082,7 +9082,40 @@ UPDATE TR SET TR.[TranType] = .dbo.vefn_GetNewTranType(NN.FormatID, NN.NewFormat
|
||||
-- Transitions are done
|
||||
-- SELECT * From Transitions where DTS = @DTS and UserID = @UserID
|
||||
--print 'Z ' + cast(datediff(s,@dts,getdate()) as varchar(100))
|
||||
|
||||
if exists (select * from contents where config like '%FloatingFoldout%')
|
||||
begin
|
||||
--foldouts fixing code
|
||||
--insert into #mytemp
|
||||
select cc.contentid,xsteps.value('@FloatingFoldout','int') oldfoldoutid,(select newitemid
|
||||
from @children
|
||||
where itemid = xsteps.value('@FloatingFoldout','int')) newfoldoutid,xconfig
|
||||
into #mytemp
|
||||
from (select *,cast(config as xml) xconfig from contents where contentid in (select newcontentid from @children)) cc
|
||||
cross apply xconfig.nodes('Config/Step') tsteps(xsteps)
|
||||
--build @cmd string
|
||||
declare @cmd nvarchar(max)
|
||||
declare cmds cursor for
|
||||
select distinct 'update #mytemp set xconfig.modify(''replace value of (Config/Step/@FloatingFoldout)[1] with "'
|
||||
+ cast(newfoldoutid as varchar(10))
|
||||
+ '"'') where xconfig.value(''(Config/Step/@FloatingFoldout)[1]'',''int'') = '
|
||||
+ cast(oldfoldoutid as varchar(10))
|
||||
from #mytemp
|
||||
--execute cursor over rows
|
||||
open cmds
|
||||
fetch next from cmds into @cmd
|
||||
while @@fetch_status = 0
|
||||
begin
|
||||
exec sp_executesql @cmd
|
||||
fetch next from cmds into @cmd
|
||||
end
|
||||
close cmds
|
||||
deallocate cmds
|
||||
--actually update contents
|
||||
update cc set config = cast(xconfig as varchar(max)) from contents cc join #mytemp mt on cc.contentid = mt.contentid
|
||||
--get rid of #mytemp
|
||||
drop table #mytemp
|
||||
--end foldouts fixing code
|
||||
end
|
||||
IF( @@TRANCOUNT > 0 ) COMMIT
|
||||
END TRY
|
||||
BEGIN CATCH -- Catch Block
|
||||
|
Loading…
x
Reference in New Issue
Block a user