Added code to correct 16-bit applicability conversion to 32-bit applicability

This commit is contained in:
Rich
2014-03-04 02:03:42 +00:00
parent 8810301dde
commit 651266e7c8
3 changed files with 41 additions and 26 deletions

View File

@@ -5356,23 +5356,15 @@ CREATE FUNCTION [dbo].[ve_GetItemApplicability] (@ItemID int) RETURNS varchar(ma
WITH EXECUTE AS OWNER
AS
BEGIN
declare @apple varchar(max)
select @apple = isnull(r2.value('@Applicability','varchar(max)'),'-1')
from
(
select itemid,cast(config as xml) xconfig from items ii join contents cc on ii.contentid = cc.contentid
) t1
outer apply xconfig.nodes('//MasterSlave') t2(r2)
where itemid = @ItemID
if @apple = '-1' begin
set @apple = ''
select @apple = coalesce(@apple + ',','') + r2.value('@index','varchar(max)') from
(select cast(config as xml) xconfig from docversions
where versionid = dbo.vefn_GetVersionIDByItemID(@ItemID)) ah
cross apply xconfig.nodes('//Slave') t2(r2)
set @apple = substring(@apple,2,len(@apple))
end
return @apple
declare @apple varchar(max)
select @apple = r2.value('@Applicability','varchar(max)')
from
(
select itemid,cast(config as xml) xconfig from items ii join contents cc on ii.contentid = cc.contentid
) t1
outer apply xconfig.nodes('//MasterSlave') t2(r2)
where itemid = @ItemID
return @apple
END
GO
IF (@@Error = 0) PRINT 'ScalerFunction [vefn_GetItemApplicability] Succeeded'
@@ -5410,7 +5402,7 @@ WITH EXECUTE AS OWNER
AS
BEGIN
with Itemz([Relationship], [ItemID], [ContentID], [PreviousID]) as (
Select 1 [Relati@Parentsonship], [ItemID], [ContentID], [PreviousID]
Select 1 [Relationship], [ItemID], [ContentID], [PreviousID]
FROM [Items]
where [ItemID]=@ItemID
Union All
@@ -5460,13 +5452,24 @@ WITH EXECUTE AS OWNER
AS
BEGIN
declare @apple varchar(max)
set @apple = ''
select @apple = @apple + ',' + cast(id as varchar(10))
from [dbo].[vefn_ParentItems](@ItemID)
cross apply vefn_SplitInt([dbo].[ve_GetItemApplicability](itemid),',')
where [dbo].[ve_GetItemApplicability](itemid) != '-1'
group by id having count(*) = (select count(*) from [dbo].[vefn_ParentItems](@ItemID) where [dbo].[ve_GetItemApplicability](itemid) != '-1')
return substring(@apple,2,len(@apple))
select @apple = dbo.ve_getitemapplicability(@ItemID)
if @apple is null
begin
declare @ParentID int
select @ParentID = dbo.ve_getparentitem(@ItemID)
if @parentid is not null
set @apple = dbo.ve_GetItemDerivedApplicability(@ParentID)
else
begin
set @apple = ''
select @apple = coalesce(@apple + ',','') + r2.value('@index','varchar(max)') from
(select cast(config as xml) xconfig from docversions
where versionid = dbo.vefn_GetVersionIDByItemID(@ItemID)) ah
cross apply xconfig.nodes('//Slave') t2(r2)
set @apple = substring(@apple,2,len(@apple))
end
end
return @apple
END
GO
-- Display the status of TableFunction creation