--:SetVar Function "AUX:ToString.DateTime"
if exists( select * from [sysobjects] (nolock) where [type] in ('FN','TF') and [name]=N'AUX:ToString.DateTime' )
   drop function [AUX:ToString.DateTime]
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:ToString.DateTime]( @DateTime datetime2 )
returns nvarchar(50)
BEGIN
/*==================================================================================================
# SQLAUX scripting library | Author: Sergei Y.Kitáev
----------------------------------------------------------------------------------------------------
#
# CONVERSION FROM DATE-TIME TO STRING:
# - “MM/DD/YYYY HH::MM::SS” (EN);
# - “DD.MM.YYYY HH::MM::SS” (RU)
#
# === Usage: ===
# dbo.[AUX:ToString.DateTime]( <Date-time> )
#
==================================================================================================*/

if @DateTime is null return null

return
   dbo.[AUX:ToString.Date]( @DateTime )+' '+
   dbo.[AUX:ToString.Time]( @DateTime )

/*================================================================================================*/
END
GO
/*
select dbo.[AUX:ToString.DateTime]( GETDATE() ) 'Current date-time as string'
*/
