36 lines
1.8 KiB
Plaintext
36 lines
1.8 KiB
Plaintext
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[foo_DBExportMMEDirections]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
|
|
DROP FUNCTION [dbo].[foo_DBExportMMEDirections]
|
|
GO
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[foo_DBExportMMEDirections]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
|
|
BEGIN
|
|
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[foo_DBExportMMEDirections]
|
|
(
|
|
)
|
|
RETURNS xml
|
|
AS
|
|
BEGIN
|
|
RETURN isnull((
|
|
SELECT [s_GUID]
|
|
,[DIRECTION]
|
|
,[TEXT_L1]
|
|
,[TEXT_L2]
|
|
,[DATE]
|
|
,[VERSION]
|
|
,[EXPIRED]
|
|
,[REMARKS]
|
|
,[LAST_CHANGE]
|
|
,[LAST_CHANGE_TEXT]
|
|
,[HISTORY]
|
|
,[SORTKEY]
|
|
FROM [dbo].[MMEDirections] CustomDirection
|
|
for xml auto, BINARY BASE64, root (''CustomDirections'')), ''<CustomDirections />'')
|
|
END
|
|
'
|
|
END
|
|
|
|
GO
|