-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Mittwoch, 20. Mai 2015, 16:13:11
-- For the Low Level Business Logic Layer for the database 'bea'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE [bea]
GO

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Berechtigung'
-- Gets: @iBerechtigungNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Berechtigung_Insert]
	@iBerechtigungNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Berechtigung]
(
	[BerechtigungNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
)
VALUES
(
	@iBerechtigungNr,
	@iParentID,
	@sBezeichnung,
	@sBeschreibung,
	@iSequenz,
	@bAktiv,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@iCID
)
-- 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_Berechtigung_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Berechtigung_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Berechtigung'
-- Gets: @iBerechtigungNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Berechtigung_Update]
	@iBerechtigungNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Berechtigung]
SET 
	[ParentID] = @iParentID,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Sequenz] = @iSequenz,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[CID] = @iCID
WHERE
	[BerechtigungNr] = @iBerechtigungNr
-- 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_Berechtigung_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Berechtigung_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Berechtigung'
-- using the Primary Key. 
-- Gets: @iBerechtigungNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Berechtigung_Delete]
	@iBerechtigungNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Berechtigung]
WHERE
	[BerechtigungNr] = @iBerechtigungNr
-- 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_Berechtigung_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Berechtigung_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Berechtigung'
-- based on the Primary Key.
-- Gets: @iBerechtigungNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Berechtigung_SelectOne]
	@iBerechtigungNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[BerechtigungNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Berechtigung]
WHERE
	[BerechtigungNr] = @iBerechtigungNr
-- 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_Berechtigung_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Berechtigung_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Berechtigung'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Berechtigung_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[BerechtigungNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Berechtigung]
ORDER BY 
	[BerechtigungNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'funktionsgruppe'
-- Gets: @ifunktionsgruppenr int
-- Gets: @sbezeichnung varchar(255)
-- Gets: @sbeschreibung varchar(50)
-- Gets: @szugehoerigkeit varchar(255)
-- Gets: @imandantnr int
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_Insert]
	@ifunktionsgruppenr int,
	@sbezeichnung varchar(255),
	@sbeschreibung varchar(50),
	@szugehoerigkeit varchar(255),
	@imandantnr int,
	@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].[funktionsgruppe]
(
	[funktionsgruppenr],
	[bezeichnung],
	[beschreibung],
	[zugehoerigkeit],
	[mandantnr],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
)
VALUES
(
	@ifunktionsgruppenr,
	@sbezeichnung,
	@sbeschreibung,
	@szugehoerigkeit,
	@imandantnr,
	@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_funktionsgruppe_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_funktionsgruppe_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'funktionsgruppe'
-- Gets: @ifunktionsgruppenr int
-- Gets: @sbezeichnung varchar(255)
-- Gets: @sbeschreibung varchar(50)
-- Gets: @szugehoerigkeit varchar(255)
-- Gets: @imandantnr int
-- Gets: @baktiv bit
-- Gets: @daerstellt_am datetime
-- Gets: @damutiert_am datetime
-- Gets: @imutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_Update]
	@ifunktionsgruppenr int,
	@sbezeichnung varchar(255),
	@sbeschreibung varchar(50),
	@szugehoerigkeit varchar(255),
	@imandantnr int,
	@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].[funktionsgruppe]
SET 
	[bezeichnung] = @sbezeichnung,
	[beschreibung] = @sbeschreibung,
	[zugehoerigkeit] = @szugehoerigkeit,
	[mandantnr] = @imandantnr,
	[aktiv] = @baktiv,
	[erstellt_am] = @daerstellt_am,
	[mutiert_am] = @damutiert_am,
	[mutierer] = @imutierer
WHERE
	[funktionsgruppenr] = @ifunktionsgruppenr
-- 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_funktionsgruppe_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_funktionsgruppe_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'funktionsgruppe'
-- using the Primary Key. 
-- Gets: @ifunktionsgruppenr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_Delete]
	@ifunktionsgruppenr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[funktionsgruppe]
WHERE
	[funktionsgruppenr] = @ifunktionsgruppenr
-- 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_funktionsgruppe_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_funktionsgruppe_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'funktionsgruppe'
-- based on the Primary Key.
-- Gets: @ifunktionsgruppenr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_SelectOne]
	@ifunktionsgruppenr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[funktionsgruppenr],
	[bezeichnung],
	[beschreibung],
	[zugehoerigkeit],
	[mandantnr],
	[aktiv],
	[erstellt_am],
	[mutiert_am],
	[mutierer]
FROM [dbo].[funktionsgruppe]
WHERE
	[funktionsgruppenr] = @ifunktionsgruppenr
-- 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_funktionsgruppe_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_funktionsgruppe_SelectAll]
GO

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


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Funktionstelle'
-- Gets: @iFunktionstelleNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sFunktionsnummer varchar(255)
-- Gets: @sFunktionsstelle varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Funktionstelle_Insert]
	@iFunktionstelleNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@sFunktionsnummer varchar(255),
	@sFunktionsstelle varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Funktionstelle]
(
	[FunktionstelleNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Funktionsnummer],
	[Funktionsstelle],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
)
VALUES
(
	@iFunktionstelleNr,
	@iParentID,
	@sBezeichnung,
	@sBeschreibung,
	@sFunktionsnummer,
	@sFunktionsstelle,
	@iSequenz,
	@bAktiv,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@iCID
)
-- 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_Funktionstelle_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Funktionstelle_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Funktionstelle'
-- Gets: @iFunktionstelleNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sFunktionsnummer varchar(255)
-- Gets: @sFunktionsstelle varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Funktionstelle_Update]
	@iFunktionstelleNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@sFunktionsnummer varchar(255),
	@sFunktionsstelle varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Funktionstelle]
SET 
	[ParentID] = @iParentID,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Funktionsnummer] = @sFunktionsnummer,
	[Funktionsstelle] = @sFunktionsstelle,
	[Sequenz] = @iSequenz,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[CID] = @iCID
WHERE
	[FunktionstelleNr] = @iFunktionstelleNr
-- 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_Funktionstelle_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Funktionstelle_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Funktionstelle'
-- using the Primary Key. 
-- Gets: @iFunktionstelleNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Funktionstelle_Delete]
	@iFunktionstelleNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Funktionstelle]
WHERE
	[FunktionstelleNr] = @iFunktionstelleNr
-- 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_Funktionstelle_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Funktionstelle_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Funktionstelle'
-- based on the Primary Key.
-- Gets: @iFunktionstelleNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Funktionstelle_SelectOne]
	@iFunktionstelleNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[FunktionstelleNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Funktionsnummer],
	[Funktionsstelle],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Funktionstelle]
WHERE
	[FunktionstelleNr] = @iFunktionstelleNr
-- 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_Funktionstelle_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Funktionstelle_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Funktionstelle'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Funktionstelle_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[FunktionstelleNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Funktionsnummer],
	[Funktionsstelle],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Funktionstelle]
ORDER BY 
	[FunktionstelleNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Personal'
-- Gets: @iPersonalnr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sTGNummer varchar(255)
-- Gets: @sName varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_Insert]
	@iPersonalnr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@sTGNummer varchar(255),
	@sName varchar(255),
	@iSequenz int,
	@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].[Personal]
(
	[Personalnr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[TGNummer],
	[Name],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
)
VALUES
(
	@iPersonalnr,
	@iParentID,
	@sBezeichnung,
	@sBeschreibung,
	@sTGNummer,
	@sName,
	@iSequenz,
	@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_Personal_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Personal'
-- Gets: @iPersonalnr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @sTGNummer varchar(255)
-- Gets: @sName varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_Update]
	@iPersonalnr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@sTGNummer varchar(255),
	@sName varchar(255),
	@iSequenz int,
	@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].[Personal]
SET 
	[ParentID] = @iParentID,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[TGNummer] = @sTGNummer,
	[Name] = @sName,
	[Sequenz] = @iSequenz,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer
WHERE
	[Personalnr] = @iPersonalnr
-- 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_Personal_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Personal'
-- using the Primary Key. 
-- Gets: @iPersonalnr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_Delete]
	@iPersonalnr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Personal]
WHERE
	[Personalnr] = @iPersonalnr
-- 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_Personal_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Personal'
-- based on the Primary Key.
-- Gets: @iPersonalnr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_SelectOne]
	@iPersonalnr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[Personalnr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[TGNummer],
	[Name],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
FROM [dbo].[Personal]
WHERE
	[Personalnr] = @iPersonalnr
-- 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_Personal_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Personal_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Personal'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Personal_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[Personalnr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[TGNummer],
	[Name],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
FROM [dbo].[Personal]
ORDER BY 
	[Personalnr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Plattform'
-- Gets: @iPlattformNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Plattform_Insert]
	@iPlattformNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Plattform]
(
	[PlattformNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
)
VALUES
(
	@iPlattformNr,
	@iParentID,
	@sBezeichnung,
	@sBeschreibung,
	@iSequenz,
	@bAktiv,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@iCID
)
-- 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_Plattform_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Plattform_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Plattform'
-- Gets: @iPlattformNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Plattform_Update]
	@iPlattformNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Plattform]
SET 
	[ParentID] = @iParentID,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Sequenz] = @iSequenz,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[CID] = @iCID
WHERE
	[PlattformNr] = @iPlattformNr
-- 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_Plattform_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Plattform_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Plattform'
-- using the Primary Key. 
-- Gets: @iPlattformNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Plattform_Delete]
	@iPlattformNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Plattform]
WHERE
	[PlattformNr] = @iPlattformNr
-- 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_Plattform_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Plattform_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Plattform'
-- based on the Primary Key.
-- Gets: @iPlattformNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Plattform_SelectOne]
	@iPlattformNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[PlattformNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Plattform]
WHERE
	[PlattformNr] = @iPlattformNr
-- 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_Plattform_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Plattform_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Plattform'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Plattform_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[PlattformNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Plattform]
ORDER BY 
	[PlattformNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Server'
-- Gets: @iServerNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Server_Insert]
	@iServerNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Server]
(
	[ServerNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
)
VALUES
(
	@iServerNr,
	@iParentID,
	@sBezeichnung,
	@sBeschreibung,
	@iSequenz,
	@bAktiv,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@iCID
)
-- 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_Server_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Server_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Server'
-- Gets: @iServerNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @iCID int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Server_Update]
	@iServerNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@bAktiv bit,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@iCID int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Server]
SET 
	[ParentID] = @iParentID,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Sequenz] = @iSequenz,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[CID] = @iCID
WHERE
	[ServerNr] = @iServerNr
-- 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_Server_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Server_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Server'
-- using the Primary Key. 
-- Gets: @iServerNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Server_Delete]
	@iServerNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Server]
WHERE
	[ServerNr] = @iServerNr
-- 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_Server_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Server_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Server'
-- based on the Primary Key.
-- Gets: @iServerNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Server_SelectOne]
	@iServerNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[ServerNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Server]
WHERE
	[ServerNr] = @iServerNr
-- 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_Server_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Server_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Server'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Server_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[ServerNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[CID]
FROM [dbo].[Server]
ORDER BY 
	[ServerNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Verwaltung_durch'
-- Gets: @iVerwaltung_durchNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_durch_Insert]
	@iVerwaltung_durchNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@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].[Verwaltung_durch]
(
	[Verwaltung_durchNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
)
VALUES
(
	@iVerwaltung_durchNr,
	@iParentID,
	@sBezeichnung,
	@sBeschreibung,
	@iSequenz,
	@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_Verwaltung_durch_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_durch_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Verwaltung_durch'
-- Gets: @iVerwaltung_durchNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_durch_Update]
	@iVerwaltung_durchNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@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].[Verwaltung_durch]
SET 
	[ParentID] = @iParentID,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Sequenz] = @iSequenz,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer
WHERE
	[Verwaltung_durchNr] = @iVerwaltung_durchNr
-- 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_Verwaltung_durch_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_durch_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Verwaltung_durch'
-- using the Primary Key. 
-- Gets: @iVerwaltung_durchNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_durch_Delete]
	@iVerwaltung_durchNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Verwaltung_durch]
WHERE
	[Verwaltung_durchNr] = @iVerwaltung_durchNr
-- 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_Verwaltung_durch_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_durch_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Verwaltung_durch'
-- based on the Primary Key.
-- Gets: @iVerwaltung_durchNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_durch_SelectOne]
	@iVerwaltung_durchNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[Verwaltung_durchNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
FROM [dbo].[Verwaltung_durch]
WHERE
	[Verwaltung_durchNr] = @iVerwaltung_durchNr
-- 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_Verwaltung_durch_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_durch_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Verwaltung_durch'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_durch_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[Verwaltung_durchNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
FROM [dbo].[Verwaltung_durch]
ORDER BY 
	[Verwaltung_durchNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Verwaltung_mit'
-- Gets: @iVerwaltung_mitNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_mit_Insert]
	@iVerwaltung_mitNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@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].[Verwaltung_mit]
(
	[Verwaltung_mitNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
)
VALUES
(
	@iVerwaltung_mitNr,
	@iParentID,
	@sBezeichnung,
	@sBeschreibung,
	@iSequenz,
	@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_Verwaltung_mit_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_mit_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Verwaltung_mit'
-- Gets: @iVerwaltung_mitNr int
-- Gets: @iParentID int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @iSequenz int
-- Gets: @bAktiv bit
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_mit_Update]
	@iVerwaltung_mitNr int,
	@iParentID int,
	@sBezeichnung varchar(255),
	@sBeschreibung varchar(255),
	@iSequenz int,
	@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].[Verwaltung_mit]
SET 
	[ParentID] = @iParentID,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Sequenz] = @iSequenz,
	[Aktiv] = @bAktiv,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer
WHERE
	[Verwaltung_mitNr] = @iVerwaltung_mitNr
-- 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_Verwaltung_mit_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_mit_Delete]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will delete an existing row from the table 'Verwaltung_mit'
-- using the Primary Key. 
-- Gets: @iVerwaltung_mitNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_mit_Delete]
	@iVerwaltung_mitNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- DELETE an existing row from the table.
DELETE FROM [dbo].[Verwaltung_mit]
WHERE
	[Verwaltung_mitNr] = @iVerwaltung_mitNr
-- 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_Verwaltung_mit_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_mit_SelectOne]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Verwaltung_mit'
-- based on the Primary Key.
-- Gets: @iVerwaltung_mitNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_mit_SelectOne]
	@iVerwaltung_mitNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[Verwaltung_mitNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
FROM [dbo].[Verwaltung_mit]
WHERE
	[Verwaltung_mitNr] = @iVerwaltung_mitNr
-- 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_Verwaltung_mit_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Verwaltung_mit_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Verwaltung_mit'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Verwaltung_mit_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[Verwaltung_mitNr],
	[ParentID],
	[Bezeichnung],
	[Beschreibung],
	[Sequenz],
	[Aktiv],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer]
FROM [dbo].[Verwaltung_mit]
ORDER BY 
	[Verwaltung_mitNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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