SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE   VIEW [xtract].[nominal_accounts] AS

SELECT [client_db]
     , [subsidiary_to_company_ref]
     , [nominal_account_number]
     , [account_description]
--      , [is_profit_loss_account]
--      , [vat_key]
--      , [create_date]
--      , [create_employee_number]
--      , [oldest_accountable_month]
     , right('0000' + convert(varchar(10), [nominal_account_number]), 4) AS [Konto_Nr]
     , right('0000' + convert(varchar(10), [nominal_account_number]), 4) + ' - ' + [account_description] AS [Konto_Bezeichnung]
     , iif(([is_profit_loss_account] = 'J'), '2', '1') AS [GuV_Bilanz]
     , left(convert(varchar(10), [nominal_account_number]), 1) AS [Susa]

FROM [LOCOSOFT].[dbo].[nominal_accounts]
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
