--:SetVar Function "AUX:FormatGUID"
if exists( select * from [sysobjects] (nolock) where [type] in ('FN','TF') and [name]=N'AUX:FormatGUID' )
   drop function [AUX:FormatGUID]
GO
/* Translated by $SQLTRANS utility (SQL-file technology). Method author: Sergei Y.Kitáev.
** Script translation date-time: 2022-11-27 00:29:27.24 (stamp of SQL-file generation). */
create function [AUX:FormatGUID]( @Identifier uniqueidentifier )
returns char(38)
BEGIN
/*==================================================================================================
# SQLAUX scripting library | Author: Sergei Y.Kitáev
----------------------------------------------------------------------------------------------------
#
# GUID FORMATTING (CONVERSION TO STRING WITH BOUNDING CURLY BRACKETS):
#
# === Usage: ===
# dbo.[AUX:FormatGUID]( <Itendifier> )
#
==================================================================================================*/

if @Identifier is null
   return '{'+'???'+'}'

return '{'+CONVERT( char(36), @Identifier )+'}'

/*================================================================================================*/
END
GO
/*
select dbo.[AUX:FormatGUID]( '5C2B43BB-5E3C-4E09-AC22-0CAFD0C6B830' ) 'GUID'
select dbo.[AUX:FormatGUID]( NEWID() ) 'GUID'
select dbo.[AUX:FormatGUID]( null ) 'GUID'
*/
