--:SetVar Function "AUX:ToStringFS.Int"
if exists( select * from [sysobjects] (nolock) where [type] in ('FN','TF') and [name]=N'AUX:ToStringFS.Int' )
   drop function [AUX:ToStringFS.Int]
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). */
GO
create function [AUX:ToStringFS.Int]( @Number int, @AbsValueWidthForZeroPadding int=null )
returns varchar(max)
BEGIN
/*==================================================================================================
# SQLAUX scripting library | Author: Sergei Y.Kitáev
----------------------------------------------------------------------------------------------------
#
# NUMBER CONVERSION TO STRING, WITH FIXED PRECISION (“INT” TYPE):
#
# === Usage: ===
# dbo.[AUX:ToStringFS.Int]( <Number>, <Absolute value width for zero padding> )
# dbo.[AUX:ToStringFS.Int]( <Number>, null )
#
==================================================================================================*/

if @Number is null return null

return dbo.[AUX:ZeroLeftPadByWidthOfAbs](
   CONVERT( varchar(11), @Number ),
   ISNULL( @AbsValueWidthForZeroPadding, 11-1 ) )

/*================================================================================================*/
END
GO
/*
select dbo.[AUX:ToStringFS.Int]( 345178, 10 ) 'Number as string (fixed prec.)'
select dbo.[AUX:ToStringFS.Int]( -8435, 10 ) 'Number as string (fixed prec.)'
*/
