--:SetVar Function "AUX:IsInServerAdminRole"
if exists( select * from [sysobjects] (nolock) where [type] in ('FN','TF') and [name]=N'AUX:IsInServerAdminRole' )
   drop function [AUX:IsInServerAdminRole]
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:IsInServerAdminRole]()
returns bit
BEGIN
/*==================================================================================================
# SQLAUX scripting library | Author: Sergei Y.Kitáev
----------------------------------------------------------------------------------------------------
#
# CHECKING, IF CONNECTED USER IS IN SERVER ADMINISTRATOR ROLE:
#
# === Usage: ===
# dbo.[AUX:IsInServerAdminRole]()
#
==================================================================================================*/

return CONVERT( bit, ISNULL(IS_SRVROLEMEMBER('sysadmin'),0) )

/*================================================================================================*/
END
GO
/*
select dbo.[AUX:IsInServerAdminRole]() 'Is in SQL-administrator role'
*/
