:SetVar Procedure "AUX:RaiseUnexpectedInternalError"
:r $(DropProcedureScript_AUX)
create procedure [$(Procedure)]
   @ProcedureName    $(dt_String_AUX) = 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_AUX)
----------------------------------------------------------------------------------------------------
declare @LanguageId int
set @LanguageId = dbo.[AUX:TechLanguage]()
if @LanguageId=$(num_LanguageId_English_AUX) goto IN_ENGLISH
if @LanguageId=$(num_LanguageId_Russian_AUX) goto IN_RUSSIAN
goto $(DefaultLanguageLabel)
----------------------------------------------------------------------------------------------------
declare @ErrorMessage $(dt_String_AUX)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IN_ENGLISH:
if @ProcedureName is not null
   $(AppendErrorMessageLine_AUX)
      'Unexpected internal error in ['+@ProcedureName+'] procedure.'
else
   $(AppendErrorMessageLine_AUX)
      'Unexpected internal error.'
if @SituationMarker is not null
   $(AppendErrorMessageLine_AUX)
      'Situation marker: '+CONVERT( $(dt_GuidStr_AUX), @SituationMarker )+'.'
raiserror (@ErrorMessage,11,1)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IN_RUSSIAN:
if @ProcedureName is not null
   $(AppendErrorMessageLine_AUX)
      N'Непредвиденная внутренняя ошибка в процедуре ['+@ProcedureName+N'].'
else
   $(AppendErrorMessageLine_AUX)
      N'Непредвиденная внутренняя ошибка.'
if @SituationMarker is not null
   $(AppendErrorMessageLine_AUX)
      N'Маркер ситуации: '+CONVERT( $(dt_GuidStr_AUX), @SituationMarker )+N'.'
raiserror (@ErrorMessage,11,1)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$(END_AUX)
/*================================================================================================*/
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]
*/
