:SetVar Procedure "BKRG::GetServiceUser"
:r $(DropProcedureScript_AUX)
create procedure [$(Procedure)]
   @LoginName  $(dt_String_AUX),
   @Status     uniqueidentifier  = null out,
   @Message    $(dt_Message_AUX) = null out
AS
/*==================================================================================================
# BookRegistry app. | Author: Sergei Y.Kitáev
----------------------------------------------------------------------------------------------------
#
# USER INFORMATION EXTRACTION:
#
# === Usage: ===
# exec @RetValue = [BKRG::GetServiceUser] @Status=@Status out, @Message=@Message out
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# === Result-set: ===
# [LoginName]        $(dt_LoginName)      not null,
# [CreationDate]     datetime2            not null,
# [Initials]         $(dt_NormalName)     not null,
# [LastName]         $(dt_NormalName)     not null,
# [FirstName]        $(dt_NormalName),
# [SecondName]       $(dt_NormalName),
# [IsAdministrator]  bit                  not null,
# [IsActiveUser]     bit                  not null,
# [PasswordData]     $(dt_UserPassword)
--------------------------------------------------------------------------------------------------*/
-- commstat_, commstat_, ...
:SetVar Status_EmptyLoginName "'6A6CEF0F-A1D2-421D-B220-FB0F8FDB4C2F'"
/*================================================================================================*/
$(BEGIN_AUX)
----------------------------------------------------------------------------------------------------
select @Status=null, @Message=null
----------------------------------------------------------------------------------------------------
if @LoginName is null
   exec [AUX:RaiseIncorrectProcedureCall] N'$(Procedure)'
----------------------------------------------------------------------------------------------------
if @LoginName = ''
begin
   select @Status=$(Status_EmptyLoginName), @Message=dbo.[AUX:LocalizedText](
      'Empty login name was specified.',
      N'Указано пустое имя входа.' )
   RETURN 1
end
----------------------------------------------------------------------------------------------------
set @LoginName = TRIM( @LoginName )

select * from [ServiceUsers] where [LoginName] = @LoginName

----------------------------------------------------------------------------------------------------
$(END_AUX)
/*================================================================================================*/
GO
/*
declare @RetValue int, @Status uniqueidentifier, @Message nvarchar(max)
exec @RetValue = [BKRG::GetServiceUser] 'user1', @Status=@Status out, @Message=@Message out
if @RetValue<>0 select @RetValue 'RetValue', @Status 'Status', @Message 'Message'
*/
/*
declare @RetValue int, @Status uniqueidentifier, @Message nvarchar(max)
exec @RetValue = [BKRG::GetServiceUser] '$pushkin', @Status=@Status out, @Message=@Message out
if @RetValue<>0 select @RetValue 'RetValue', @Status 'Status', @Message 'Message'
*/
/*
declare @RetValue int, @Status uniqueidentifier, @Message nvarchar(max)
exec @RetValue = [BKRG::GetServiceUser] 'xuser', @Status=@Status out, @Message=@Message out
if @RetValue<>0 select @RetValue 'RetValue', @Status 'Status', @Message 'Message'
*/
/*
declare @RetValue int, @Status uniqueidentifier, @Message nvarchar(max)
exec @RetValue = [BKRG::GetServiceUser] '', @Status=@Status out, @Message=@Message out
if @RetValue<>0 select @RetValue 'RetValue', @Status 'Status', @Message 'Message'
*/
/*
declare @RetValue int, @Status uniqueidentifier, @Message nvarchar(max)
exec @RetValue = [BKRG::GetServiceUser] null, @Status=@Status out, @Message=@Message out
if @RetValue<>0 select @RetValue 'RetValue', @Status 'Status', @Message 'Message'
*/
