USE [GC]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

DROP TABLE [data].[GC_Config]
GO


CREATE TABLE [data].[GC_Config](
	[Variable] [varchar](50) NOT NULL,
	[Wert] [varchar](50) NOT NULL,
 CONSTRAINT [PK_GC_Config] PRIMARY KEY CLUSTERED 
(
	[Variable] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO


CREATE VIEW data.GC_Config_Pivot AS

select len_invoice_number
from
(
  select Variable, Wert
  from data.GC_Config
) d
pivot
(
  max(Wert)
  for Variable in (len_invoice_number)
) piv;
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
