--:SetVar Function "AUX:BitInversion"
if exists( select * from [sysobjects] (nolock) where [type] in ('FN','TF') and [name]=N'AUX:BitInversion' )
   drop function [AUX:BitInversion]
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:BitInversion]( @Value bit )
returns bit
BEGIN
/*==================================================================================================
# SQLAUX scripting library | Author: Sergei Y.Kitáev
----------------------------------------------------------------------------------------------------
#
# LOGICAL FLAG INVERSION (1/0; “BIT” TYPE):
#
# === Usage: ===
# dbo.[AUX:BitInversion]( <Value> )
#
==================================================================================================*/

return
   case @Value
      when 0 then 1
      when 1 then 0
   end

/*================================================================================================*/
END
GO
/*
select dbo.[AUX:BitInversion]( 0 ) 'Logical flag inversion of 0'
select dbo.[AUX:BitInversion]( 1 ) 'Logical flag inversion of 1'
select dbo.[AUX:BitInversion]( null ) 'Logical flag inversion of null'
*/
