--:SetVar Procedure "AUX:RaiseUnexpectedInternalError"
if exists( select * from [sysobjects] (nolock) where [type]='P' and [name]=N'AUX:RaiseUnexpectedInternalError' )
   drop procedure [AUX:RaiseUnexpectedInternalError]
GO
/* Translated by $SQLTRANS utility (SQL-file technology). Method author: Sergei Y.Kitáev.
** Script translation date-time: 2022-11-27 00:29:29.24 (stamp of SQL-file generation). */
create procedure [AUX:RaiseUnexpectedInternalError]
   @ProcedureName    nvarchar(max) = null,
   @SituationMarker  uniqueidentifier = null
AS
/*==================================================================================================
# SQLAUX scripting library | Author: Sergei Y.Kitáev
----------------------------------------------------------------------------------------------------
#
# GENERATION OF UNEXPECTED INTERNAL ERROR IN STORED PROCEDURE OR SCRIPT:
#
# === Usage: ===
# exec [AUX:RaiseUnexpectedInternalError] <Procedure name>
# exec [AUX:RaiseUnexpectedInternalError] <Procedure name>, <Situation marker>
# exec [AUX:RaiseUnexpectedInternalError]
# exec [AUX:RaiseUnexpectedInternalError] null, <Situation marker>
#
==================================================================================================*/
begin begin try set xact_abort off; set ansi_nulls,ansi_null_dflt_on,quoted_identifier,arithabort,nocount on; set implicit_transactions off; declare @initial_tran_count_aux int, @is_local_tran_open_aux bit; select @initial_tran_count_aux=@@trancount, @is_local_tran_open_aux=0; end try begin catch throw; end catch; begin try
----------------------------------------------------------------------------------------------------
declare @LanguageId int
set @LanguageId = dbo.[AUX:TechLanguage]()
if @LanguageId=0 goto IN_ENGLISH
if @LanguageId=21 goto IN_RUSSIAN
goto IN_ENGLISH
----------------------------------------------------------------------------------------------------
declare @ErrorMessage nvarchar(max)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IN_ENGLISH:
if @ProcedureName is not null
   set @ErrorMessage = case when ISNULL(@ErrorMessage,'')<>'' then ISNULL(@ErrorMessage,'')+(char(13)+char(10)) else '' end +
      'Unexpected internal error in ['+@ProcedureName+'] procedure.'
else
   set @ErrorMessage = case when ISNULL(@ErrorMessage,'')<>'' then ISNULL(@ErrorMessage,'')+(char(13)+char(10)) else '' end +
      'Unexpected internal error.'
if @SituationMarker is not null
   set @ErrorMessage = case when ISNULL(@ErrorMessage,'')<>'' then ISNULL(@ErrorMessage,'')+(char(13)+char(10)) else '' end +
      'Situation marker: '+CONVERT( char(36), @SituationMarker )+'.'
raiserror (@ErrorMessage,11,1)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IN_RUSSIAN:
if @ProcedureName is not null
   set @ErrorMessage = case when ISNULL(@ErrorMessage,'')<>'' then ISNULL(@ErrorMessage,'')+(char(13)+char(10)) else '' end +
      N'Непредвиденная внутренняя ошибка в процедуре ['+@ProcedureName+N'].'
else
   set @ErrorMessage = case when ISNULL(@ErrorMessage,'')<>'' then ISNULL(@ErrorMessage,'')+(char(13)+char(10)) else '' end +
      N'Непредвиденная внутренняя ошибка.'
if @SituationMarker is not null
   set @ErrorMessage = case when ISNULL(@ErrorMessage,'')<>'' then ISNULL(@ErrorMessage,'')+(char(13)+char(10)) else '' end +
      N'Маркер ситуации: '+CONVERT( char(36), @SituationMarker )+N'.'
raiserror (@ErrorMessage,11,1)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if @is_local_tran_open_aux=1 raiserror ('Not closed local transaction was detected, previously opened by BEGIN_TRANSACTION_AUX macro.',11,1); end try begin catch if @is_local_tran_open_aux=1 and (@@trancount>@initial_tran_count_aux or xact_state()=-1) rollback transaction; set @is_local_tran_open_aux=0; throw; end catch; end
/*================================================================================================*/
GO
/*
exec [AUX:RaiseUnexpectedInternalError] 'XProc'
exec [AUX:RaiseUnexpectedInternalError] 'XProc', '11C7BA65-9075-4C9E-BB5A-FCAEDBE62F95'
exec [AUX:RaiseUnexpectedInternalError] null, 'F701CE8D-DD22-423D-9B78-206239E80D30'
exec [AUX:RaiseUnexpectedInternalError]
*/
