USE [TIM]
GO

ALTER TABLE [dbo].[KB_Artikel] DROP CONSTRAINT [DF_KB_Artikel_Aktiv_Reaktiv]
GO

/****** Object:  Table [dbo].[KB_Anspruchsgruppe]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Anspruchsgruppe]
GO

/****** Object:  Table [dbo].[KB_Absender]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Absender]
GO

/****** Object:  Table [dbo].[KB_Themengruppe]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Themengruppe]
GO

/****** Object:  Table [dbo].[KB]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB]
GO

/****** Object:  Table [dbo].[KB_Absender_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Absender_Artikel]
GO

/****** Object:  Table [dbo].[KB_Anspruchgruppe_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Anspruchgruppe_Artikel]
GO

/****** Object:  Table [dbo].[KB_Themengruppe_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Themengruppe_Artikel]
GO

/****** Object:  Table [dbo].[KB_Artikel_Save]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Artikel_Save]
GO

/****** Object:  Table [dbo].[KB_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Artikel]
GO

/****** Object:  Table [dbo].[KB_Parameter]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[KB_Parameter]
GO

/****** Object:  Table [dbo].[UserLog]    Script Date: 17.05.2014 14:32:58 ******/
DROP TABLE [dbo].[UserLog]
GO

/****** Object:  Table [dbo].[UserLog]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[UserLog](
	[nreintrag] [int] IDENTITY(1,1) NOT NULL,
	[Timestamp] [datetime] NULL,
	[LoginName] [varchar](255) NULL,
	[Action] [varchar](255) NULL,
	[Details] [varchar](1024) NULL,
 CONSTRAINT [PK_UserLog] PRIMARY KEY CLUSTERED 
(
	[nreintrag] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

/****** Object:  Table [dbo].[KB_Parameter]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[KB_Parameter](
	[KBParameternr] [int] IDENTITY(1,1) NOT NULL,
	[Bezeichnung] [varchar](50) NULL,
	[Beschreibung] [varchar](50) NULL,
	[Aktiv] [bit] NULL,
	[Erstellt_am] [datetime] NULL,
	[Mutiert_am] [datetime] NULL,
	[Mutierer] [int] NULL,
 CONSTRAINT [PK_KB_Parameter] PRIMARY KEY CLUSTERED 
(
	[KBParameternr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

/****** Object:  Table [dbo].[KB_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[KB_Artikel](
	[Artikelnr] [int] NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Beschreibung] [varchar](255) NULL,
	[Suchbegriffe] [varchar](255) NULL,
	[Gueltig_ab] [datetime] NULL,
	[Gueltig_bis] [datetime] NULL,
	[Artikel] [varchar](4096) NULL,
	[Aktiv] [bit] NULL,
	[Erstellt_am] [datetime] NULL,
	[Mutiert_am] [datetime] NULL,
	[Mutierer] [int] NULL,
	[Aktiv_Reaktiv] [bit] NULL,
 CONSTRAINT [PK_KB_Artikel] PRIMARY KEY CLUSTERED 
(
	[Artikelnr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

/****** Object:  Table [dbo].[KB_Artikel_Save]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[KB_Artikel_Save](
	[Artikelnr] [int] IDENTITY(1,1) NOT NULL,
	[A1] [nvarchar](255) NULL,
	[A2] [nvarchar](255) NULL,
	[A3] [nvarchar](255) NULL,
	[A4] [nvarchar](255) NULL,
	[B1] [nvarchar](255) NULL,
	[B2] [nvarchar](255) NULL,
	[B3] [nvarchar](255) NULL,
	[B4] [nvarchar](255) NULL,
	[B5] [nvarchar](255) NULL,
	[B6] [nvarchar](255) NULL,
	[B7] [nvarchar](255) NULL,
	[C1] [nvarchar](255) NULL,
	[C2] [nvarchar](255) NULL,
	[C3] [nvarchar](255) NULL,
	[F15] [nvarchar](255) NULL,
	[C4] [nvarchar](255) NULL,
	[C5] [nvarchar](255) NULL,
	[C6] [nvarchar](255) NULL,
	[C7] [nvarchar](255) NULL,
	[C8] [nvarchar](255) NULL,
	[C9] [nvarchar](255) NULL,
	[C10] [nvarchar](255) NULL,
	[C11] [nvarchar](255) NULL,
	[Artikel] [nvarchar](max) NULL,
	[F25] [nvarchar](255) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

/****** Object:  Table [dbo].[KB_Themengruppe_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[KB_Themengruppe_Artikel](
	[Themengruppe_Artikelnr] [int] IDENTITY(1,1) NOT NULL,
	[Themengruppenr] [int] NULL,
	[Artikelnr] [int] NULL,
	[Aktiv] [bit] NULL,
	[Erstellt_am] [datetime] NULL,
	[Mutiert_am] [datetime] NULL,
	[Mutierer] [int] NULL,
 CONSTRAINT [PK_KB_Themengruppe_Artikel] PRIMARY KEY CLUSTERED 
(
	[Themengruppe_Artikelnr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[KB_Anspruchgruppe_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[KB_Anspruchgruppe_Artikel](
	[Ansprchgruppe_Artikelnr] [int] IDENTITY(1,1) NOT NULL,
	[Anspruchgruppenr] [int] NULL,
	[Artikelnr] [int] NULL,
	[Aktiv] [bit] NULL,
	[Erstellt_am] [datetime] NULL,
	[Mutiert_am] [datetime] NULL,
	[Mutierer] [int] NULL,
 CONSTRAINT [PK_KB_Anspruchgruppe_Artikel] PRIMARY KEY CLUSTERED 
(
	[Ansprchgruppe_Artikelnr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[KB_Absender_Artikel]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[KB_Absender_Artikel](
	[Absender_Artikeln] [int] IDENTITY(1,1) NOT NULL,
	[AbsenderNr] [int] NULL,
	[Artikelnr] [int] NULL,
	[aktiv] [bit] NULL,
	[erstellt_am] [datetime] NULL,
	[mutiert_am] [datetime] NULL,
	[mutierer] [int] NULL,
 CONSTRAINT [PK_KB_Absender_Artikel] PRIMARY KEY CLUSTERED 
(
	[Absender_Artikeln] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[KB]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[KB](
	[KBNummer] [int] NOT NULL,
	[Titel] [varchar](255) NULL,
	[Beschreibung] [varchar](1024) NULL,
	[Suchbegriffe] [varchar](1024) NULL,
	[Gueltig_ab] [datetime] NULL,
	[Gueltig_bis] [datetime] NULL,
	[Botschaft_Text] [varchar](4096) NULL,
	[aktiv] [bit] NULL,
	[erstellt_am] [datetime] NULL,
	[mutiert_am] [datetime] NULL,
	[mutierer] [int] NULL,
 CONSTRAINT [PK_KB] PRIMARY KEY CLUSTERED 
(
	[KBNummer] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

/****** Object:  Table [dbo].[KB_Themengruppe]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[KB_Themengruppe](
	[Themengruppenr] [int] NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Beschreibung] [varchar](255) NULL,
	[aktiv] [bit] NULL,
	[erstellt_am] [datetime] NULL,
	[mutiert_am] [datetime] NULL,
	[mutierer] [int] NULL,
 CONSTRAINT [PK_KB_Themengruppe] PRIMARY KEY CLUSTERED 
(
	[Themengruppenr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

/****** Object:  Table [dbo].[KB_Absender]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[KB_Absender](
	[AbsenderNr] [int] NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Beschreibung] [varchar](255) NULL,
	[aktiv] [bit] NULL,
	[erstellt_am] [datetime] NULL,
	[mutiert_am] [datetime] NULL,
	[mutierer] [int] NULL,
 CONSTRAINT [PK_kb_absender] PRIMARY KEY CLUSTERED 
(
	[AbsenderNr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

/****** Object:  Table [dbo].[KB_Anspruchsgruppe]    Script Date: 17.05.2014 14:32:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[KB_Anspruchsgruppe](
	[Anspruchgruppenr] [int] NOT NULL,
	[Bezeichnung] [varchar](255) NULL,
	[Beschreibung] [varchar](255) NULL,
	[aktiv] [bit] NULL,
	[erstellt_am] [datetime] NULL,
	[mutiert_am] [datetime] NULL,
	[mutierer] [int] NULL,
 CONSTRAINT [PK_KB_Anspruchsgruppe] PRIMARY KEY CLUSTERED 
(
	[Anspruchgruppenr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[KB_Artikel] ADD  CONSTRAINT [DF_KB_Artikel_Aktiv_Reaktiv]  DEFAULT ((0)) FOR [Aktiv_Reaktiv]
GO

