Added DocPdf field for caching
This commit is contained in:
@@ -402,6 +402,7 @@ CREATE PROCEDURE [dbo].[addDocument]
|
||||
@DTS datetime,
|
||||
@UserID nvarchar(100),
|
||||
@FileExtension nvarchar(10),
|
||||
@DocPdf varbinary(MAX)=null,
|
||||
@newDocID int output,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
@@ -417,7 +418,8 @@ BEGIN TRY -- Try Block
|
||||
[Config],
|
||||
[DTS],
|
||||
[UserID],
|
||||
[FileExtension]
|
||||
[FileExtension],
|
||||
[DocPdf]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@@ -427,7 +429,8 @@ BEGIN TRY -- Try Block
|
||||
@Config,
|
||||
@DTS,
|
||||
@UserID,
|
||||
@FileExtension
|
||||
@FileExtension,
|
||||
@DocPdf
|
||||
)
|
||||
SELECT @newDocID= SCOPE_IDENTITY()
|
||||
SELECT @newLastChanged=[LastChanged]
|
||||
@@ -1855,10 +1858,10 @@ INSERT INTO [Entries] ([ContentID],[DocID],[DTS],[UserID])
|
||||
SELECT NN.[NewContentID],EE.[DocID],@DTS,@UserID
|
||||
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
||||
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') <> ''
|
||||
-- Logic to create new documents for any documents used that do not have libttitles
|
||||
INSERT INTO [Documents] ([LibTitle],[DocContent],[DocAscii],[Config],[DTS],[UserID],[FileExtension])
|
||||
-- Logic to create new documents for any documents used that do not have libtitles
|
||||
INSERT INTO [Documents] ([LibTitle],[DocContent],[DocAscii],[Config],[DTS],[UserID],[FileExtension],[DocPdf])
|
||||
OUTPUT CAST(INSERTED.[LibTitle] as INT),INSERTED.[DocID] INTO @NewDocuments
|
||||
SELECT str(DD.[DocID]),[DocContent],[DocAscii],[Config],@DTS,@UserID,[FileExtension]
|
||||
SELECT str(DD.[DocID]),[DocContent],[DocAscii],[Config],@DTS,@UserID,[FileExtension],[DocPdf]
|
||||
FROM [Entries] EE JOIN @Children NN on NN.ContentID = EE.ContentID
|
||||
JOIN [Documents] DD on EE.[DocID] = DD.[DocID] and Isnull(LibTitle,'') = ''
|
||||
UPDATE DD SET LibTitle = ''
|
||||
@@ -4622,7 +4625,8 @@ AS
|
||||
[Documents].[Config] [Document_Config],
|
||||
[Documents].[DTS] [Document_DTS],
|
||||
[Documents].[UserID] [Document_UserID],
|
||||
[Documents].[FileExtension] [Document_FileExtension]
|
||||
[Documents].[FileExtension] [Document_FileExtension],
|
||||
[Documents].[DocPdf] [Document_DocPdf]
|
||||
FROM [Entries]
|
||||
JOIN [Documents] ON
|
||||
[Documents].[DocID]=[Entries].[DocID]
|
||||
@@ -4910,6 +4914,7 @@ AS
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
[FileExtension],
|
||||
[DocPdf],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
||||
FROM [Documents]
|
||||
WHERE [DocID]=@DocID
|
||||
@@ -4959,6 +4964,7 @@ AS
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
[FileExtension],
|
||||
[DocPdf],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
||||
FROM [Documents]
|
||||
RETURN
|
||||
@@ -5235,7 +5241,8 @@ AS
|
||||
[Documents].[Config] [Document_Config],
|
||||
[Documents].[DTS] [Document_DTS],
|
||||
[Documents].[UserID] [Document_UserID],
|
||||
[Documents].[FileExtension] [Document_FileExtension]
|
||||
[Documents].[FileExtension] [Document_FileExtension],
|
||||
[Documents].[DocPdf] [Document_DocPdf]
|
||||
FROM [Entries]
|
||||
JOIN [Documents] ON
|
||||
[Documents].[DocID]=[Entries].[DocID]
|
||||
@@ -6554,6 +6561,7 @@ SELECT
|
||||
[DTS],
|
||||
[UserID],
|
||||
[LastChanged],
|
||||
[DocPdf],
|
||||
(SELECT COUNT(*) FROM [Entries] WHERE [Entries].[DocID]=[Documents].[DocID]) [EntryCount]
|
||||
FROM [Documents] where [LibTitle] <> '' order by [LibTitle]
|
||||
RETURN
|
||||
@@ -9240,6 +9248,7 @@ CREATE PROCEDURE [dbo].[updateDocument]
|
||||
@UserID nvarchar(100),
|
||||
@LastChanged timestamp,
|
||||
@FileExtension nvarchar(10),
|
||||
@DocPdf varbinary(MAX)=null,
|
||||
@newLastChanged timestamp output
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
@@ -9254,7 +9263,8 @@ BEGIN TRY -- Try Block
|
||||
[Config]=@Config,
|
||||
[DTS]=@DTS,
|
||||
[UserID]=@UserID,
|
||||
[FileExtension]=@FileExtension
|
||||
[FileExtension]=@FileExtension,
|
||||
[DocPdf]=@DocPdf
|
||||
WHERE [DocID]=@DocID AND [LastChanged]=@LastChanged
|
||||
IF @@ROWCOUNT = 0
|
||||
BEGIN
|
||||
@@ -11966,7 +11976,7 @@ 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')
|
||||
Select * from vefn_GetFormatFieldByStepType('Off') where name ='AEP'
|
||||
|
||||
*/
|
||||
|
||||
@@ -11994,6 +12004,7 @@ BEGIN
|
||||
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 +
|
||||
.dbo.vefn_XmlPath(v1.query('.')) +
|
||||
+ '@' + 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
|
||||
@@ -12020,7 +12031,7 @@ BEGIN
|
||||
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 +
|
||||
case when v1.exist('.') is null THEN '' ELSE v1.value('local-name(.)','varchar(max)') + coalesce('[' + v1.value('@Index','varchar(255)')+']','') + '/' 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}'
|
||||
@@ -12044,6 +12055,70 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType Su
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetFormatFieldByStepType2] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetFormatFieldByStepType2]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetFormatFieldByStepType2];
|
||||
GO
|
||||
|
||||
/*
|
||||
Select * from vefn_GetFormatFieldByStepType2('Font')
|
||||
Select * from vefn_GetFormatFieldByStepType2('PSADJBNGROW')
|
||||
Select * from vefn_GetFormatFieldByStepType2('SectionTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType2('PrintNoTitle')
|
||||
Select * from vefn_GetFormatFieldByStepType2('Off')
|
||||
|
||||
*/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetFormatFieldByStepType2](@find varchar(255))
|
||||
RETURNS @FormatFields TABLE
|
||||
(
|
||||
FormatID int
|
||||
,Name varchar(20)
|
||||
,Description varchar(250)
|
||||
,Path varchar(max)
|
||||
,StepType varchar(255)
|
||||
,Indx varchar(255)
|
||||
,Value varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
INSERT INTO @FormatFields
|
||||
Select FormatID, Name, Description,
|
||||
.dbo.vefn_XmlPath(v9.query('.')) +
|
||||
.dbo.vefn_XmlPath(v8.query('.')) +
|
||||
.dbo.vefn_XmlPath(v7.query('.')) +
|
||||
.dbo.vefn_XmlPath(v6.query('.')) +
|
||||
.dbo.vefn_XmlPath(v5.query('.')) +
|
||||
.dbo.vefn_XmlPath(v4.query('.')) +
|
||||
.dbo.vefn_XmlPath(v3.query('.')) +
|
||||
.dbo.vefn_XmlPath(v2.query('.')) +
|
||||
.dbo.vefn_XmlPath(v1.query('.')) +
|
||||
+ '@' + v.value('local-name(.)','varchar(max)') Path
|
||||
, coalesce(v.value('../@Type','varchar(255)'),v.value('../../@Type','varchar(255)'),v.value('../../../@Type','varchar(255)')) StepType
|
||||
, coalesce(v1.value('@Index','varchar(255)'),v2.value('@Index','varchar(255)'),v3.value('@Index','varchar(255)')) Indx
|
||||
, 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 + '%'
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType2 Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatFieldByStepType2 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];
|
||||
@@ -12141,6 +12216,37 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetFormatValues Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetFormatValues Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetGenMacMacros] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetGenMacMacros]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetGenMacMacros];
|
||||
GO
|
||||
|
||||
/*
|
||||
Select * from vefn_GetGenMacMacros()
|
||||
*/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetGenMacMacros]()
|
||||
RETURNS @GenMacMacros TABLE
|
||||
(
|
||||
FormatID int
|
||||
,Name varchar(20)
|
||||
,Description varchar(250)
|
||||
,MacroName varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
INSERT INTO @GenMacMacros
|
||||
Select FormatID, Name, Description,v.value('@id','varchar(20)') MacroName
|
||||
FROM Formats CROSS APPLY GenMac.nodes('//g') TempXML(v)
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetGenMacMacros Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetGenMacMacros Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_GetInheritedFormat] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetInheritedFormat]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetInheritedFormat];
|
||||
@@ -12916,6 +13022,24 @@ IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_SplitROSearch Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_SplitROSearch Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vefn_XmlPath] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_XmlPath]') AND OBJECTPROPERTY(id,N'IsScalarFunction') = 1)
|
||||
DROP FUNCTION [vefn_XmlPath];
|
||||
GO
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_XmlPath] (@xml XML) RETURNS varchar(255)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
return case when @xml.exist('*[1]') is null THEN '' ELSE @xml.value('local-name(*[1])','varchar(max)') +
|
||||
coalesce('[' + @xml.value('*[1]/@Type','varchar(255)')+']','[' + @xml.value('*[1]/@Index','varchar(255)')+']','') + '/' END
|
||||
END;
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'ScalarFunction Creation: vefn_XmlPath Succeeded'
|
||||
ELSE PRINT 'ScalarFunction Creation: vefn_XmlPath Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_CleanUpItems] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_CleanUpItems]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_CleanUpItems];
|
||||
@@ -13004,6 +13128,41 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFields Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFields Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsAll] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsAll]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsAll];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatFieldsAll 'PrintNoTitle'
|
||||
vesp_GetFormatFieldsAll 'Sep'
|
||||
vesp_GetFormatFieldsAll 'TabFormat'
|
||||
vesp_GetFormatFieldsAll 'ShowSectionTitles'
|
||||
vesp_GetFormatFieldsAll 'Caution'
|
||||
vesp_GetFormatFieldsAll 'Ident'
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetFormatFieldsAll]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from Formats
|
||||
order by ',[' + [Name] + ']' for xml path('')),1,1,'')
|
||||
DECLARE @query VARCHAR(max)
|
||||
SET @query = 'SELECT * FROM (Select Name,Path,Value From vefn_GetFormatField(''' + @find + ''')) T1 PIVOT ( Count(Name) FOR [Name] IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY PATH,VALUE'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFieldsAll Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsAll 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];
|
||||
@@ -13044,6 +13203,46 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType Succe
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetFormatFieldsByStepType2] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetFormatFieldsByStepType2]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetFormatFieldsByStepType2];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetFormatFieldsByStepType2 'PrintNoTitle'
|
||||
vesp_GetFormatFieldsByStepType2 'Sep'
|
||||
vesp_GetFormatFieldsByStepType2 'TabFormat'
|
||||
vesp_GetFormatFieldsByStepType2 'ShowSectionTitles'
|
||||
vesp_GetFormatFieldsByStepType2 'Caution'
|
||||
vesp_GetFormatFieldsByStepType2 'Ident'
|
||||
vesp_GetFormatFieldsByStepType2 'Off'
|
||||
*/
|
||||
|
||||
Create PROCEDURE [dbo].[vesp_GetFormatFieldsByStepType2]
|
||||
(
|
||||
@find varchar(255)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from vefn_GetFormatFieldByStepType2(@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_GetFormatFieldByStepType2(''' + @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_GetFormatFieldsByStepType2 Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatFieldsByStepType2 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];
|
||||
@@ -13194,6 +13393,37 @@ IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsNoValues Su
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetFormatGroupFieldsNoValues Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: StoredProcedure [vesp_GetGenMacMacros] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_GetGenMacMacros]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
|
||||
DROP PROCEDURE [vesp_GetGenMacMacros];
|
||||
GO
|
||||
|
||||
/*
|
||||
vesp_GetGenMacMacros
|
||||
*/
|
||||
|
||||
CREATE PROCEDURE [dbo].[vesp_GetGenMacMacros]
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
declare @pivotlist varchar(max)
|
||||
select @pivotlist = stuff((select distinct ',[' + [Name] + ']' from vefn_GetGenMacMacros()
|
||||
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,MacroName From vefn_GetGenMacMacros()) T1 PIVOT ( Count(Name) FOR [Name] IN (' + @pivotlist + ') ) AS Pivot1 ORDER BY MacroName'
|
||||
print @Query
|
||||
EXECUTE(@query)
|
||||
END
|
||||
GO
|
||||
-- Display the status of Proc creation
|
||||
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_GetGenMacMacros Succeeded'
|
||||
ELSE PRINT 'Procedure Creation: vesp_GetGenMacMacros 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];
|
||||
|
Reference in New Issue
Block a user