-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Freitag, 4. Januar 2013, 16:59:46
-- For the Low Level Business Logic Layer for the database 'themenmanagement'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE [themenmanagement]
GO

-- ========================================================================================================
-- [Stored Procedures generated for table:  Kategorie]
GO

-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kategorie_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kategorie_Insert]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Kategorie'
-- Gets: @iKategorieNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(1024)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kategorie_Insert]
	@iKategorieNr int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(1024),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Kategorie]
(
	[KategorieNr],
	[Bezeichnung],
	[Beschreibung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
)
VALUES
(
	@iKategorieNr,
	@sBezeichnung,
	@sBeschreibung,
	@baktiv,
	@daerstellt_am,
	@damutiert_am,
	@imutierer
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kategorie_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kategorie_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Kategorie'
-- Gets: @iKategorieNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(1024)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kategorie_Update]
	@iKategorieNr int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(1024),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Kategorie]
SET 
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer
WHERE
	[KategorieNr] = @iKategorieNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kategorie_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kategorie_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Kategorie'
-- using the Primary Key. 
-- Gets: @iKategorieNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kategorie_Delete]
	@iKategorieNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Kategorie]
WHERE
	[KategorieNr] = @iKategorieNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kategorie_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kategorie_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Kategorie'
-- based on the Primary Key.
-- Gets: @iKategorieNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kategorie_SelectOne]
	@iKategorieNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[KategorieNr],
	[Bezeichnung],
	[Beschreibung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[Kategorie]
WHERE
	[KategorieNr] = @iKategorieNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kategorie_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kategorie_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Kategorie'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kategorie_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[KategorieNr],
	[Bezeichnung],
	[Beschreibung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[Kategorie]
ORDER BY 
	[KategorieNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- [End of Stored Procedures for table:     Kategorie]
-- ========================================================================================================
GO

-- ========================================================================================================
-- [Stored Procedures generated for table:  Kommunikation]
GO

-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kommunikation_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kommunikation_Insert]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Kommunikation'
-- Gets: @iKommunikationNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kommunikation_Insert]
	@iKommunikationNr int,
	@sBezeichnung varchar(255),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Kommunikation]
(
	[KommunikationNr],
	[Bezeichnung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
)
VALUES
(
	@iKommunikationNr,
	@sBezeichnung,
	@baktiv,
	@daerstellt_am,
	@damutiert_am,
	@imutierer
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kommunikation_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kommunikation_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Kommunikation'
-- Gets: @iKommunikationNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kommunikation_Update]
	@iKommunikationNr int,
	@sBezeichnung varchar(255),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Kommunikation]
SET 
	[Bezeichnung] = @sBezeichnung,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer
WHERE
	[KommunikationNr] = @iKommunikationNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kommunikation_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kommunikation_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Kommunikation'
-- using the Primary Key. 
-- Gets: @iKommunikationNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kommunikation_Delete]
	@iKommunikationNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Kommunikation]
WHERE
	[KommunikationNr] = @iKommunikationNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kommunikation_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kommunikation_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Kommunikation'
-- based on the Primary Key.
-- Gets: @iKommunikationNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kommunikation_SelectOne]
	@iKommunikationNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[KommunikationNr],
	[Bezeichnung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[Kommunikation]
WHERE
	[KommunikationNr] = @iKommunikationNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Kommunikation_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Kommunikation_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Kommunikation'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Kommunikation_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[KommunikationNr],
	[Bezeichnung],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[Kommunikation]
ORDER BY 
	[KommunikationNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- [End of Stored Procedures for table:     Kommunikation]
-- ========================================================================================================
GO

-- ========================================================================================================
-- [Stored Procedures generated for table:  KommunkationAuspraegung]
GO

-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_KommunkationAuspraegung_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_KommunkationAuspraegung_Insert]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'KommunkationAuspraegung'
-- Gets: @iKommunikationAuspraegungNr int
-- Gets: @iKommunikationNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @blobDokument image
-- Gets: @sRTFText varchar(-1)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_KommunkationAuspraegung_Insert]
	@iKommunikationAuspraegungNr int,
	@iKommunikationNr int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@blobDokument image,
	@sRTFText varchar(-1),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[KommunkationAuspraegung]
(
	[KommunikationAuspraegungNr],
	[KommunikationNr],
	[Bezeichnung],
	[Beschreibung],
	[Dokument],
	[RTFText],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
)
VALUES
(
	@iKommunikationAuspraegungNr,
	@iKommunikationNr,
	@sBezeichnung,
	@sBeschreibung,
	@blobDokument,
	@sRTFText,
	@baktiv,
	@daerstellt_am,
	@damutiert_am,
	@imutierer
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_KommunkationAuspraegung_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_KommunkationAuspraegung_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'KommunkationAuspraegung'
-- Gets: @iKommunikationAuspraegungNr int
-- Gets: @iKommunikationNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @blobDokument image
-- Gets: @sRTFText varchar(-1)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_KommunkationAuspraegung_Update]
	@iKommunikationAuspraegungNr int,
	@iKommunikationNr int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@blobDokument image,
	@sRTFText varchar(-1),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[KommunkationAuspraegung]
SET 
	[KommunikationNr] = @iKommunikationNr,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Dokument] = @blobDokument,
	[RTFText] = @sRTFText,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer
WHERE
	[KommunikationAuspraegungNr] = @iKommunikationAuspraegungNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_KommunkationAuspraegung_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_KommunkationAuspraegung_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'KommunkationAuspraegung'
-- using the Primary Key. 
-- Gets: @iKommunikationAuspraegungNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_KommunkationAuspraegung_Delete]
	@iKommunikationAuspraegungNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[KommunkationAuspraegung]
WHERE
	[KommunikationAuspraegungNr] = @iKommunikationAuspraegungNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_KommunkationAuspraegung_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_KommunkationAuspraegung_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'KommunkationAuspraegung'
-- based on the Primary Key.
-- Gets: @iKommunikationAuspraegungNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_KommunkationAuspraegung_SelectOne]
	@iKommunikationAuspraegungNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[KommunikationAuspraegungNr],
	[KommunikationNr],
	[Bezeichnung],
	[Beschreibung],
	[Dokument],
	[RTFText],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[KommunkationAuspraegung]
WHERE
	[KommunikationAuspraegungNr] = @iKommunikationAuspraegungNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_KommunkationAuspraegung_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_KommunkationAuspraegung_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'KommunkationAuspraegung'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_KommunkationAuspraegung_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[KommunikationAuspraegungNr],
	[KommunikationNr],
	[Bezeichnung],
	[Beschreibung],
	[Dokument],
	[RTFText],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[KommunkationAuspraegung]
ORDER BY 
	[KommunikationAuspraegungNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- [End of Stored Procedures for table:     KommunkationAuspraegung]
-- ========================================================================================================
GO

-- ========================================================================================================
-- [Stored Procedures generated for table:  Thema]
GO

-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Thema_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Thema_Insert]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Thema'
-- Gets: @iThemanNr int
-- Gets: @sTitel varchar(255)
-- Gets: @iKategorieNr int
-- Gets: @sBeschreibung varchar(1024)
-- Gets: @sSuchbegriffe varchar(1024)
-- Gets: @daGueltig_ab datetime
-- Gets: @daGueltig_bis datetime
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Thema_Insert]
	@iThemanNr int,
	@sTitel varchar(255),
	@iKategorieNr int,
	@sBeschreibung varchar(1024),
	@sSuchbegriffe varchar(1024),
	@daGueltig_ab datetime,
	@daGueltig_bis datetime,
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Thema]
(
	[ThemanNr],
	[Titel],
	[KategorieNr],
	[Beschreibung],
	[Suchbegriffe],
	[Gueltig_ab],
	[Gueltig_bis],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
)
VALUES
(
	@iThemanNr,
	@sTitel,
	@iKategorieNr,
	@sBeschreibung,
	@sSuchbegriffe,
	@daGueltig_ab,
	@daGueltig_bis,
	@baktiv,
	@daerstellt_am,
	@damutiert_am,
	@imutierer
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Thema_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Thema_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Thema'
-- Gets: @iThemanNr int
-- Gets: @sTitel varchar(255)
-- Gets: @iKategorieNr int
-- Gets: @sBeschreibung varchar(1024)
-- Gets: @sSuchbegriffe varchar(1024)
-- Gets: @daGueltig_ab datetime
-- Gets: @daGueltig_bis datetime
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Thema_Update]
	@iThemanNr int,
	@sTitel varchar(255),
	@iKategorieNr int,
	@sBeschreibung varchar(1024),
	@sSuchbegriffe varchar(1024),
	@daGueltig_ab datetime,
	@daGueltig_bis datetime,
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Thema]
SET 
	[Titel] = @sTitel,
	[KategorieNr] = @iKategorieNr,
	[Beschreibung] = @sBeschreibung,
	[Suchbegriffe] = @sSuchbegriffe,
	[Gueltig_ab] = @daGueltig_ab,
	[Gueltig_bis] = @daGueltig_bis,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer
WHERE
	[ThemanNr] = @iThemanNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Thema_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Thema_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Thema'
-- using the Primary Key. 
-- Gets: @iThemanNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Thema_Delete]
	@iThemanNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Thema]
WHERE
	[ThemanNr] = @iThemanNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Thema_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Thema_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Thema'
-- based on the Primary Key.
-- Gets: @iThemanNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Thema_SelectOne]
	@iThemanNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[ThemanNr],
	[Titel],
	[KategorieNr],
	[Beschreibung],
	[Suchbegriffe],
	[Gueltig_ab],
	[Gueltig_bis],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[Thema]
WHERE
	[ThemanNr] = @iThemanNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Thema_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Thema_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Thema'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Thema_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[ThemanNr],
	[Titel],
	[KategorieNr],
	[Beschreibung],
	[Suchbegriffe],
	[Gueltig_ab],
	[Gueltig_bis],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[Thema]
ORDER BY 
	[ThemanNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- [End of Stored Procedures for table:     Thema]
-- ========================================================================================================
GO

-- ========================================================================================================
-- [Stored Procedures generated for table:  ThemaEntwicklung]
GO

-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_ThemaEntwicklung_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_ThemaEntwicklung_Insert]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'ThemaEntwicklung'
-- Gets: @iThemaEntwicklungNr int
-- Gets: @iThemaNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @blobDokument image
-- Gets: @sRTFText varchar(-1)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_ThemaEntwicklung_Insert]
	@iThemaEntwicklungNr int,
	@iThemaNr int,
	@sBezeichnung varchar(255),
	@blobDokument image,
	@sRTFText varchar(-1),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[ThemaEntwicklung]
(
	[ThemaEntwicklungNr],
	[ThemaNr],
	[Bezeichnung],
	[Dokument],
	[RTFText],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
)
VALUES
(
	@iThemaEntwicklungNr,
	@iThemaNr,
	@sBezeichnung,
	@blobDokument,
	@sRTFText,
	@baktiv,
	@daerstellt_am,
	@damutiert_am,
	@imutierer
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_ThemaEntwicklung_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_ThemaEntwicklung_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'ThemaEntwicklung'
-- Gets: @iThemaEntwicklungNr int
-- Gets: @iThemaNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @blobDokument image
-- Gets: @sRTFText varchar(-1)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_ThemaEntwicklung_Update]
	@iThemaEntwicklungNr int,
	@iThemaNr int,
	@sBezeichnung varchar(255),
	@blobDokument image,
	@sRTFText varchar(-1),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@imutierer int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[ThemaEntwicklung]
SET 
	[ThemaNr] = @iThemaNr,
	[Bezeichnung] = @sBezeichnung,
	[Dokument] = @blobDokument,
	[RTFText] = @sRTFText,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer
WHERE
	[ThemaEntwicklungNr] = @iThemaEntwicklungNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_ThemaEntwicklung_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_ThemaEntwicklung_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'ThemaEntwicklung'
-- using the Primary Key. 
-- Gets: @iThemaEntwicklungNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_ThemaEntwicklung_Delete]
	@iThemaEntwicklungNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[ThemaEntwicklung]
WHERE
	[ThemaEntwicklungNr] = @iThemaEntwicklungNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_ThemaEntwicklung_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_ThemaEntwicklung_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'ThemaEntwicklung'
-- based on the Primary Key.
-- Gets: @iThemaEntwicklungNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_ThemaEntwicklung_SelectOne]
	@iThemaEntwicklungNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[ThemaEntwicklungNr],
	[ThemaNr],
	[Bezeichnung],
	[Dokument],
	[RTFText],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[ThemaEntwicklung]
WHERE
	[ThemaEntwicklungNr] = @iThemaEntwicklungNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_ThemaEntwicklung_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_ThemaEntwicklung_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'ThemaEntwicklung'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_ThemaEntwicklung_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[ThemaEntwicklungNr],
	[ThemaNr],
	[Bezeichnung],
	[Dokument],
	[RTFText],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[ThemaEntwicklung]
ORDER BY 
	[ThemaEntwicklungNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- [End of Stored Procedures for table:     ThemaEntwicklung]
-- ========================================================================================================
GO

-- ========================================================================================================
-- [Stored Procedures generated for table:  Zielgruppe]
GO

-- //// Insert Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Zielgruppe_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Zielgruppe_Insert]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Zielgruppe'
-- Gets: @iZielgruppeNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Zielgruppe_Insert]
	@iZielgruppeNr int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Zielgruppe]
(
	[ZielgruppeNr],
	[Bezeichnung],
	[Beschreibung],
	[aktiv],
	[erstellt_am],
	[mutiert_am]
)
VALUES
(
	@iZielgruppeNr,
	@sBezeichnung,
	@sBeschreibung,
	@baktiv,
	@daerstellt_am,
	@damutiert_am
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Update Stored procedure for updating one single row.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Zielgruppe_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Zielgruppe_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Zielgruppe'
-- Gets: @iZielgruppeNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Zielgruppe_Update]
	@iZielgruppeNr int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@baktiv bit,
	@daerstellt_am datetime,
	@damutiert_am datetime,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Zielgruppe]
SET 
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am
WHERE
	[ZielgruppeNr] = @iZielgruppeNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Delete Stored procedure using Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Zielgruppe_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Zielgruppe_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Zielgruppe'
-- using the Primary Key. 
-- Gets: @iZielgruppeNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Zielgruppe_Delete]
	@iZielgruppeNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Zielgruppe]
WHERE
	[ZielgruppeNr] = @iZielgruppeNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select Stored procedure, based on Primary Key.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Zielgruppe_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Zielgruppe_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Zielgruppe'
-- based on the Primary Key.
-- Gets: @iZielgruppeNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Zielgruppe_SelectOne]
	@iZielgruppeNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[ZielgruppeNr],
	[Bezeichnung],
	[Beschreibung],
	[aktiv],
	[erstellt_am],
	[mutiert_am]
FROM [dbo].[Zielgruppe]
WHERE
	[ZielgruppeNr] = @iZielgruppeNr
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- //// Select All Stored procedure.
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pr_Zielgruppe_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Zielgruppe_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Zielgruppe'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Zielgruppe_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[ZielgruppeNr],
	[Bezeichnung],
	[Beschreibung],
	[aktiv],
	[erstellt_am],
	[mutiert_am]
FROM [dbo].[Zielgruppe]
ORDER BY 
	[ZielgruppeNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


-- [End of Stored Procedures for table:     Zielgruppe]
-- ========================================================================================================
GO
