Added vefn_GetROTokens to find tokens in Documents.DocAscii
Added vefn_GetVersionNames to get Folder names for DocVersions (Working Drafts)
This commit is contained in:
parent
36bf0cda84
commit
cc62d25333
@ -7146,6 +7146,93 @@ IF (@@Error = 0) PRINT 'Procedure Creation: getRoUsagesByROIDsAndVersions Succee
|
||||
ELSE PRINT 'Procedure Creation: getRoUsagesByROIDsAndVersions Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: TableFunction [vefn_GetROTokens] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetROTokens]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetROTokens];
|
||||
GO
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2013 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetROTokens](@text varchar(MAX))
|
||||
RETURNS @Tokens TABLE
|
||||
(
|
||||
Token varchar(MAX)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @index int
|
||||
SET @index = -1
|
||||
WHILE (LEN(@text) > 0)
|
||||
BEGIN
|
||||
SET @index = PATINDEX('%<[A-Z]-%' , @text)
|
||||
IF @index = 0
|
||||
SET @index = PATINDEX('%<[A-Z][A-Z0-9]-%' , @text)
|
||||
IF @index = 0
|
||||
SET @index = PATINDEX('%<[A-Z][A-Z][A-Z0-9]-%' , @text)
|
||||
IF @index = 0
|
||||
SET @index = PATINDEX('%<[A-Z][A-Z][A-Z][A-Z0-9]-%' , @text)
|
||||
IF @index = 0
|
||||
BREAK
|
||||
DECLARE @index2 int
|
||||
SET @index2 = CHARINDEX('>' , @text)
|
||||
if @index2 = 0
|
||||
BREAK
|
||||
INSERT INTO @Tokens VALUES (substring(@text, @index,1+@index2-@index))
|
||||
SET @text = RIGHT(@text, (LEN(@text) - @index2))
|
||||
END
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of func creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetROTokens Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetROTokens Error on Creation'
|
||||
GO
|
||||
|
||||
/****** Object: TableFunction [vefn_GetVersionNames] ******/
|
||||
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vefn_GetVersionNames]') AND OBJECTPROPERTY(id,N'IsTableFunction') = 1)
|
||||
DROP FUNCTION [vefn_GetVersionNames];
|
||||
GO
|
||||
|
||||
--
|
||||
-- select * from vefn_GetVersionNames()
|
||||
--
|
||||
|
||||
/*****************************************************************************
|
||||
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
Copyright 2013 - Volian Enterprises, Inc. All rights reserved.
|
||||
*****************************************************************************/
|
||||
|
||||
CREATE FUNCTION [dbo].[vefn_GetVersionNames]()
|
||||
RETURNS @Versions TABLE
|
||||
(
|
||||
VersionID int primary Key,
|
||||
GrandParentName nvarchar(100),
|
||||
ParentName nvarchar(100),
|
||||
FolderName nvarchar(100)
|
||||
)
|
||||
WITH EXECUTE AS OWNER
|
||||
AS
|
||||
BEGIN
|
||||
INSERT INTO @Versions
|
||||
select versionid,gf.name GrandParentName, pf.name ParentName, ff.name FolderName
|
||||
from docversions dv
|
||||
Join folders ff on ff.FolderID = DV.FolderID
|
||||
Join folders pf on pf.FolderID = ff.parentID
|
||||
Join folders gf on gf.FolderID = pf.parentid
|
||||
RETURN
|
||||
END
|
||||
GO
|
||||
-- Display the status of func creation
|
||||
IF (@@Error = 0) PRINT 'TableFunction Creation: vefn_GetVersionNames Succeeded'
|
||||
ELSE PRINT 'TableFunction Creation: vefn_GetVersionNames Error on Creation'
|
||||
GO
|
||||
|
||||
|
||||
|
||||
|
||||
-- =========================================== End of Functions and Procedures
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user