SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE VIEW [dbo].[invoices]
AS
SELECT *,
	0 AS order_customer,
	cast(T1.invoice_type AS VARCHAR(1)) + right(REPLICATE('0', 12) + cast(T1.invoice_number AS VARCHAR(12)), cast(T2.len_invoice_number AS INT)) AS invtype_invnr
FROM dbo.invoices_import T1,
	data.GC_Config_Pivot T2
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
