Added procedures and functions to analyze formats
This commit is contained in:
parent
b4cb2a0def
commit
a01acbef71
@ -6408,6 +6408,99 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getItemsByContentID Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getItemsByContentID Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getItemsByPartType] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemsByPartType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getItemsByPartType];
|
||||
GO
|
||||
|
||||
/* samples:
|
||||
getItemsByPartType 7 // tables
|
||||
getItemsByPartType 1 // procedure
|
||||
getItemsByPartType 2 // section
|
||||
getItemsByPartType 3 // Cautions
|
||||
getItemsByPartType 4 // Notes
|
||||
getItemsByPartType 5 // RNOs
|
||||
getItemsByPartType 6 // Steps
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[getItemsByPartType](@FromType int)
|
||||
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
ii.[ItemID],
|
||||
[PreviousID],
|
||||
ii.[ContentID],
|
||||
ii.[DTS],
|
||||
ii.[UserID],
|
||||
ii.[LastChanged],
|
||||
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[ItemID]=ii.[ItemID]) [AnnotationCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[ItemID]=ii.[ItemID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Items] [Next] WHERE [Next].[PreviousID]=ii.[ItemID]) [NextCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ItemID]=ii.[ItemID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[RangeID]=ii.[ItemID]) [Transition_RangeIDCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[ToID]=ii.[ItemID]) [Transition_ToIDCount]
|
||||
FROM [Items] ii
|
||||
JOIN [Parts] pp on pp.ItemID = ii.ItemID
|
||||
WHERE pp.Fromtype = @FromType
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getItemsByPartType Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getItemsByPartType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getItemsByPartTypeAndContent] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getItemsByPartTypeAndContent]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getItemsByPartTypeAndContent];
|
||||
GO
|
||||
|
||||
/* samples:
|
||||
getItemsByPartTypeAndContent 7 // tables
|
||||
getItemsByPartTypeAndContent 1 // procedure
|
||||
getItemsByPartTypeAndContent 2 // section
|
||||
getItemsByPartTypeAndContent 3 // Cautions
|
||||
getItemsByPartTypeAndContent 4 // Notes
|
||||
getItemsByPartTypeAndContent 5 // RNOs
|
||||
getItemsByPartTypeAndContent 6 // Steps
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[getItemsByPartTypeAndContent](@FromType int)
|
||||
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
SELECT
|
||||
ii.[ItemID],
|
||||
[PreviousID],
|
||||
ii.[ContentID],
|
||||
ii.[DTS],
|
||||
ii.[UserID],
|
||||
ii.[LastChanged],
|
||||
C.[Number],C.[Text],C.[Type],C.[FormatID],C.[Config],C.[DTS] [cDTS],C.[UserID] [cUserID],C.[LastChanged] [cLastChanged],
|
||||
(SELECT COUNT(*) FROM [Annotations] WHERE [Annotations].[ItemID]=ii.[ItemID]) [AnnotationCount],
|
||||
(SELECT COUNT(*) FROM [DocVersions] WHERE [DocVersions].[ItemID]=ii.[ItemID]) [DocVersionCount],
|
||||
(SELECT COUNT(*) FROM [Items] [Next] WHERE [Next].[PreviousID]=ii.[ItemID]) [NextCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ItemID]=ii.[ItemID]) [PartCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[RangeID]=ii.[ItemID]) [Transition_RangeIDCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[ToID]=ii.[ItemID]) [Transition_ToIDCount],
|
||||
(SELECT COUNT(*) FROM [Details] WHERE [Details].[ContentID]=[C].[ContentID]) [DetailCount],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[ContentID]=[C].[ContentID]) [EntryCount],
|
||||
(SELECT COUNT(*) FROM [Items] WHERE [Items].[ContentID]=[C].[ContentID]) [ItemCount],
|
||||
(SELECT COUNT(*) FROM [Parts] WHERE [Parts].[ContentID]=[C].[ContentID]) [cPartCount],
|
||||
(SELECT COUNT(*) FROM [RoUsages] WHERE [RoUsages].[ContentID]=[C].[ContentID]) [RoUsageCount],
|
||||
(SELECT COUNT(*) FROM [Transitions] WHERE [Transitions].[FromID]=[C].[ContentID]) [TransitionCount],
|
||||
(SELECT COUNT(*) FROM [ZContents] WHERE [ZContents].[ContentID]=[C].[ContentID]) [ZContentCount]
|
||||
FROM [Items] ii
|
||||
JOIN [Parts] pp on pp.ItemID = ii.ItemID
|
||||
JOIN [Contents] C on C.ContentID = ii.ContentID
|
||||
WHERE pp.Fromtype = @FromType
|
||||
RETURN
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: getItemsByPartTypeAndContent Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: getItemsByPartTypeAndContent Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [getJustRODb] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[getJustRODb]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [getJustRODb];
|
||||
@ -8375,7 +8468,7 @@ BEGIN TRY -- Try Block
|
||||
|
||||
-- Copy the item, 'NewItemID' represents the new item(s)
|
||||
-- DestFormatID is the formatid for the destination parent's format
|
||||
DECLARE @DestFormatID int
|
||||
DECLARE @DestFormatID int
|
||||
SET @DestFormatID = .dbo.vefn_GetInheritedFormat(@ItemID, 0)
|
||||
EXECUTE CopyItemAndChildren @StartItemID, @DestFormatID, @UserID, @NewItemID OUTPUT
|
||||
|
||||
@ -8486,7 +8579,7 @@ BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
-- First make a copy of the input StartItemID
|
||||
-- DestFormatID is the formatid for the destination parent's format
|
||||
DECLARE @DestFormatID int
|
||||
DECLARE @DestFormatID int
|
||||
SET @DestFormatID = .dbo.vefn_GetInheritedFormat(@ItemID, 0)
|
||||
EXECUTE CopyItemAndChildren @StartItemID, @DestFormatID, @UserID, @NewItemID OUTPUT
|
||||
-- Adjust previous field
|
||||
@ -8582,7 +8675,7 @@ BEGIN TRY -- Try Block
|
||||
BEGIN TRANSACTION
|
||||
-- First make a copy of the input CopyStartID
|
||||
-- DestFormatID is the formatid for the destination parent's format
|
||||
DECLARE @DestFormatID int
|
||||
DECLARE @DestFormatID int
|
||||
SET @DestFormatID = .dbo.vefn_GetInheritedFormat(@ItemID, 0)
|
||||
EXECUTE CopyItemAndChildren @StartItemID, @DestFormatID, @UserID, @NewItemID OUTPUT
|
||||
-- First adjust previous fields, may also have to do parts, if before first one in list.
|
||||
@ -11863,6 +11956,150 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatField Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatField Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetFormatFieldByStepType] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatFieldByStepType]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetFormatFieldByStepType];
|
||||
GO
|
||||
|
||||
/*
|
||||
Select * from vefn_GetFormatFieldByStepType('Font')
|
||||
Select * from vefn_GetFormatFieldByStepType('PSADJBNGROW')
|
||||
Select * from vefn_GetFormatFieldByStepType('SectionTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType('PrintNoTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType('Off')
|
||||
|
||||
*/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetFormatFieldByStepType](@find varchar(255))
|
||||
RETURNS @FormatFields TABLE
|
||||
(
|
||||
FormatID int
|
||||
,Name varchar(20)
|
||||
,Description varchar(250)
|
||||
,Path varchar(max)
|
||||
,StepType varchar(255)
|
||||
,Value varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
INSERT INTO @FormatFields
|
||||
Select FormatID, Name, Description,
|
||||
case when v9.exist('.') is null THEN '' ELSE v9.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v8.exist('.') is null THEN '' ELSE v8.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v7.exist('.') is null THEN '' ELSE v7.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v6.exist('.') is null THEN '' ELSE v6.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v5.exist('.') is null THEN '' ELSE v5.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v4.exist('.') is null THEN '' ELSE v4.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v3.exist('.') is null THEN '' ELSE v3.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v2.exist('.') is null THEN '' ELSE v2.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v1.exist('.') is null THEN '' ELSE v1.value('local-name(.)','varchar(max)') + '/' END +
|
||||
+ '@' + v.value('local-name(.)','varchar(max)') Path
|
||||
, coalesce(v.value('../@Type','varchar(255)'),v.value('../../@Type','varchar(255)'),v.value('../../../@Type','varchar(255)')) StepType
|
||||
, v.value('.', 'varchar(255)') Value
|
||||
FROM Formats
|
||||
CROSS APPLY Data.nodes('//*/@*') TempXML(v)
|
||||
OUTER APPLY v.nodes('..') TempXML1(v1)
|
||||
OUTER APPLY v1.nodes('..') TempXML2(v2)
|
||||
OUTER APPLY v2.nodes('..') TempXML3(v3)
|
||||
OUTER APPLY v3.nodes('..') TempXML4(v4)
|
||||
OUTER APPLY v4.nodes('..') TempXML5(v5)
|
||||
OUTER APPLY v5.nodes('..') TempXML6(v6)
|
||||
OUTER APPLY v6.nodes('..') TempXML7(v7)
|
||||
OUTER APPLY v7.nodes('..') TempXML8(v8)
|
||||
OUTER APPLY v8.nodes('..') TempXML9(v9)
|
||||
where v.value('local-name(.)', 'varchar(255)') like '%' + @find + '%'
|
||||
OR v.value('.', 'varchar(255)') like '%' + @find + '%'
|
||||
UNION ALL
|
||||
Select FormatID, Name, Description,
|
||||
case when v9.exist('.') is null THEN '' ELSE v9.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v8.exist('.') is null THEN '' ELSE v8.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v7.exist('.') is null THEN '' ELSE v7.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v6.exist('.') is null THEN '' ELSE v6.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v5.exist('.') is null THEN '' ELSE v5.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v4.exist('.') is null THEN '' ELSE v4.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v3.exist('.') is null THEN '' ELSE v3.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v2.exist('.') is null THEN '' ELSE v2.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v1.exist('.') is null THEN '' ELSE v1.value('local-name(.)','varchar(max)') + '/' END +
|
||||
+ v.value('local-name(.)','varchar(max)') Path
|
||||
, coalesce(v.value('../@Type','varchar(255)'),v.value('../../@Type','varchar(255)'),v.value('../../../@Type','varchar(255)')) StepType
|
||||
, '{node}'
|
||||
FROM Formats
|
||||
CROSS APPLY Data.nodes('//*') TempXML(v)
|
||||
OUTER APPLY v.nodes('..') TempXML1(v1)
|
||||
OUTER APPLY v1.nodes('..') TempXML2(v2)
|
||||
OUTER APPLY v2.nodes('..') TempXML3(v3)
|
||||
OUTER APPLY v3.nodes('..') TempXML4(v4)
|
||||
OUTER APPLY v4.nodes('..') TempXML5(v5)
|
||||
OUTER APPLY v5.nodes('..') TempXML6(v6)
|
||||
OUTER APPLY v6.nodes('..') TempXML7(v7)
|
||||
OUTER APPLY v7.nodes('..') TempXML8(v8)
|
||||
OUTER APPLY v8.nodes('..') TempXML9(v9)
|
||||
where v.value('local-name(.)', 'varchar(255)') like '%' + @find + '%'
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetFormatFieldNoValue] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatFieldNoValue]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetFormatFieldNoValue];
|
||||
GO
|
||||
|
||||
/*
|
||||
Select * from vefn_GetFormatFieldNoValue('Font')
|
||||
Select * from vefn_GetFormatFieldNoValue('PSADJBNGROW')
|
||||
Select * from vefn_GetFormatFieldNoValue('SectionTitle')
|
||||
Select * from vefn_GetFormatFieldNoValue('PrintNoTitle')
|
||||
Select * from vefn_GetFormatFieldNoValue('Off')
|
||||
*/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetFormatFieldNoValue](@find varchar(255))
|
||||
RETURNS @FormatFields TABLE
|
||||
(
|
||||
FormatID int
|
||||
,Name varchar(20)
|
||||
,Description varchar(250)
|
||||
,Path varchar(max)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
INSERT INTO @FormatFields
|
||||
Select FormatID, Name, Description,
|
||||
case when v9.exist('.') is null THEN '' ELSE v9.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v8.exist('.') is null THEN '' ELSE v8.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v7.exist('.') is null THEN '' ELSE v7.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v6.exist('.') is null THEN '' ELSE v6.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v5.exist('.') is null THEN '' ELSE v5.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v4.exist('.') is null THEN '' ELSE v4.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v3.exist('.') is null THEN '' ELSE v3.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v2.exist('.') is null THEN '' ELSE v2.value('local-name(.)','varchar(max)') + '/' END +
|
||||
case when v1.exist('.') is null THEN '' ELSE v1.value('local-name(.)','varchar(max)') + '/' END +
|
||||
+ '@' + v.value('local-name(.)','varchar(max)') Path
|
||||
FROM Formats
|
||||
CROSS APPLY Data.nodes('//*/@*') TempXML(v)
|
||||
OUTER APPLY v.nodes('..') TempXML1(v1)
|
||||
OUTER APPLY v1.nodes('..') TempXML2(v2)
|
||||
OUTER APPLY v2.nodes('..') TempXML3(v3)
|
||||
OUTER APPLY v3.nodes('..') TempXML4(v4)
|
||||
OUTER APPLY v4.nodes('..') TempXML5(v5)
|
||||
OUTER APPLY v5.nodes('..') TempXML6(v6)
|
||||
OUTER APPLY v6.nodes('..') TempXML7(v7)
|
||||
OUTER APPLY v7.nodes('..') TempXML8(v8)
|
||||
OUTER APPLY v8.nodes('..') TempXML9(v9)
|
||||
where v.value('local-name(.)', 'varchar(255)') like '%' + @find + '%'
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatFieldNoValue Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatFieldNoValue Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetFormatValues] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatValues]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetFormatValues];
|
||||
@ -12767,6 +13004,86 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFields Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFields Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsByStepType] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsByStepType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsByStepType];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatFieldsByStepType 'PrintNoTitle'
|
||||
vesp_GetFormatFieldsByStepType 'Sep'
|
||||
vesp_GetFormatFieldsByStepType 'TabFormat'
|
||||
vesp_GetFormatFieldsByStepType 'ShowSectionTitles'
|
||||
vesp_GetFormatFieldsByStepType 'Caution'
|
||||
vesp_GetFormatFieldsByStepType 'Ident'
|
||||
vesp_GetFormatFieldsByStepType 'Off'
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetFormatFieldsByStepType]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from vefn_GetFormatField(@find)
|
||||
order by ',[' + [Name] + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select Name,''Format Description'' Path,'''' StepType, '''' Value, Description From Formats) T1 PIVOT ( Max(Description) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,''FormatID'' Path, '''' StepType,'''' Value, FormatID From Formats) T1 PIVOT ( Max(FormatID) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,Path,StepType,Value From vefn_GetFormatFieldByStepType(''' + @find + ''')) T1 PIVOT ( Count(Name) FOR [Name] IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY PATH,StepType,VALUE'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsNoValue] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsNoValue]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsNoValue];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatFieldsNoValue 'PrintNoTitle'
|
||||
vesp_GetFormatFieldsNoValue 'Sep'
|
||||
vesp_GetFormatFieldsNoValue 'TabFormat'
|
||||
vesp_GetFormatFieldsNoValue 'ShowSectionTitles'
|
||||
vesp_GetFormatFieldsNoValue 'Caution'
|
||||
vesp_GetFormatFieldsNoValue 'Ident'
|
||||
vesp_GetFormatFieldsNoValue 'Off'
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetFormatFieldsNoValue]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from vefn_GetFormatField(@find)
|
||||
order by ',[' + [Name] + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select Name,''Format Description'' Path, Description From Formats) T1 PIVOT ( Max(Description) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,''FormatID'' Path, FormatID From Formats) T1 PIVOT ( Max(FormatID) FOR [Name] IN (' + @pivotlist + ') ) As Pivot2'
|
||||
EXECUTE(@query)
|
||||
SET @query = 'SELECT * FROM (Select Name,Path From vefn_GetFormatFieldNoValue(''' + @find + ''')) T1 PIVOT ( Count(Name) FOR [Name] IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY PATH'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFieldsNoValue Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsNoValue Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatGroupFields] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatGroupFields]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatGroupFields];
|
||||
@ -12803,6 +13120,80 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatGroupFields Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatGroupFields Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatGroupFieldsByStepType] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatGroupFieldsByStepType]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatGroupFieldsByStepType];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatGroupFieldsByStepType 'PrintNoTitle'
|
||||
vesp_GetFormatGroupFieldsByStepType 'Sep'
|
||||
vesp_GetFormatGroupFieldsByStepType 'TabFormat'
|
||||
vesp_GetFormatGroupFieldsByStepType 'ShowSectionTitles'
|
||||
vesp_GetFormatGroupFieldsByStepType 'Caution'
|
||||
vesp_GetFormatGroupFieldsByStepType 'Ident'
|
||||
vesp_GetFormatGroupFieldsByStepType 'SectionTitleLen'
|
||||
vesp_GetFormatGroupFieldsByStepType 'Off'
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetFormatGroupFieldsByStepType]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + substring([Name],1,3) + ']' from vefn_GetFormatField(@find)
|
||||
order by ',[' + substring([Name],1,3) + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select substring([Name],1,3) FormatGroup,Path,StepType,Value From vefn_GetFormatFieldByStepType(''' + @find + ''')) T1 PIVOT ( Count(FormatGroup) FOR FormatGroup IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY PATH, StepType,VALUE'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsByStepType Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsByStepType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatGroupFieldsNoValues] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatGroupFieldsNoValues]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatGroupFieldsNoValues];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatGroupFieldsNoValues 'PrintNoTitle'
|
||||
vesp_GetFormatGroupFieldsNoValues 'Sep'
|
||||
vesp_GetFormatGroupFieldsNoValues 'TabFormat'
|
||||
vesp_GetFormatGroupFieldsNoValues 'ShowSectionTitles'
|
||||
vesp_GetFormatGroupFieldsNoValues 'Caution'
|
||||
vesp_GetFormatGroupFieldsNoValues 'Ident'
|
||||
vesp_GetFormatGroupFieldsNoValues 'SectionTitleLen'
|
||||
vesp_GetFormatGroupFieldsNoValues 'Off'
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetFormatGroupFieldsNoValues]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + substring([Name],1,3) + ']' from vefn_GetFormatFieldNoValue(@find)
|
||||
order by ',[' + substring([Name],1,3) + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select substring([Name],1,3) FormatGroup,Path From vefn_GetFormatFieldNoValue(''' + @find + ''')) T1 PIVOT ( Count(FormatGroup) FOR FormatGroup IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY PATH'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsNoValues Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsNoValues Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_ListChildren] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_ListChildren]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_ListChildren];
|
||||
|
Loading…
x
Reference in New Issue
Block a user