-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Freitag, 10. April 2015, 18:59:05
-- For the Low Level Business Logic Layer for the database 'vertragsverwaltung'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE [vertragsverwaltung]
GO

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'LC_Dokument'
-- Gets: @iDokumentNr int
-- Gets: @iKeyValue int
-- Gets: @iDokType int
-- Gets: @iDokumenttypNr int
-- Gets: @sBezeichnung varchar(50)
-- Gets: @sBeschreibung varchar(2048)
-- Gets: @sFilename varchar(255)
-- Gets: @sOriginalFilename_incl_Path varchar(255)
-- Gets: @sVersion varchar(50)
-- Gets: @sVersionsNr varchar(50)
-- Gets: @daVersionsdatum datetime
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Gets: @iSecurityLevelNr int
-- Gets: @blobDocImage image
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_Dokument_Insert]
	@iDokumentNr int,
	@iKeyValue int,
	@iDokType int,
	@iDokumenttypNr int,
	@sBezeichnung varchar(50),
	@sBeschreibung varchar(2048),
	@sFilename varchar(255),
	@sOriginalFilename_incl_Path varchar(255),
	@sVersion varchar(50),
	@sVersionsNr varchar(50),
	@daVersionsdatum datetime,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iSecurityLevelNr int,
	@blobDocImage image,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[LC_Dokument]
(
	[DokumentNr],
	[KeyValue],
	[DokType],
	[DokumenttypNr],
	[Bezeichnung],
	[Beschreibung],
	[Filename],
	[OriginalFilename_incl_Path],
	[Version],
	[VersionsNr],
	[Versionsdatum],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[SecurityLevelNr],
	[DocImage]
)
VALUES
(
	@iDokumentNr,
	@iKeyValue,
	@iDokType,
	@iDokumenttypNr,
	@sBezeichnung,
	@sBeschreibung,
	@sFilename,
	@sOriginalFilename_incl_Path,
	@sVersion,
	@sVersionsNr,
	@daVersionsdatum,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@bAktiv,
	@iSecurityLevelNr,
	@blobDocImage
)
-- 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_LC_Dokument_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_Dokument_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'LC_Dokument'
-- Gets: @iDokumentNr int
-- Gets: @iKeyValue int
-- Gets: @iDokType int
-- Gets: @iDokumenttypNr int
-- Gets: @sBezeichnung varchar(50)
-- Gets: @sBeschreibung varchar(2048)
-- Gets: @sFilename varchar(255)
-- Gets: @sOriginalFilename_incl_Path varchar(255)
-- Gets: @sVersion varchar(50)
-- Gets: @sVersionsNr varchar(50)
-- Gets: @daVersionsdatum datetime
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Gets: @iSecurityLevelNr int
-- Gets: @blobDocImage image
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_Dokument_Update]
	@iDokumentNr int,
	@iKeyValue int,
	@iDokType int,
	@iDokumenttypNr int,
	@sBezeichnung varchar(50),
	@sBeschreibung varchar(2048),
	@sFilename varchar(255),
	@sOriginalFilename_incl_Path varchar(255),
	@sVersion varchar(50),
	@sVersionsNr varchar(50),
	@daVersionsdatum datetime,
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iSecurityLevelNr int,
	@blobDocImage image,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[LC_Dokument]
SET 
	[KeyValue] = @iKeyValue,
	[DokType] = @iDokType,
	[DokumenttypNr] = @iDokumenttypNr,
	[Bezeichnung] = @sBezeichnung,
	[Beschreibung] = @sBeschreibung,
	[Filename] = @sFilename,
	[OriginalFilename_incl_Path] = @sOriginalFilename_incl_Path,
	[Version] = @sVersion,
	[VersionsNr] = @sVersionsNr,
	[Versionsdatum] = @daVersionsdatum,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[Aktiv] = @bAktiv,
	[SecurityLevelNr] = @iSecurityLevelNr,
	[DocImage] = @blobDocImage
WHERE
	[DokumentNr] = @iDokumentNr
-- 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_LC_Dokument_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_Dokument_Delete]
GO

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

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'LC_Dokument'
-- based on the Primary Key.
-- Gets: @iDokumentNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_Dokument_SelectOne]
	@iDokumentNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[DokumentNr],
	[KeyValue],
	[DokType],
	[DokumenttypNr],
	[Bezeichnung],
	[Beschreibung],
	[Filename],
	[OriginalFilename_incl_Path],
	[Version],
	[VersionsNr],
	[Versionsdatum],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[SecurityLevelNr],
	[DocImage]
FROM [dbo].[LC_Dokument]
WHERE
	[DokumentNr] = @iDokumentNr
-- 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_LC_Dokument_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_Dokument_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'LC_Dokument'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_Dokument_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[DokumentNr],
	[KeyValue],
	[DokType],
	[DokumenttypNr],
	[Bezeichnung],
	[Beschreibung],
	[Filename],
	[OriginalFilename_incl_Path],
	[Version],
	[VersionsNr],
	[Versionsdatum],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[SecurityLevelNr],
	[DocImage]
FROM [dbo].[LC_Dokument]
ORDER BY 
	[DokumentNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'LC_DokumentAblageort'
-- Gets: @iDokumentablageortNr int
-- Gets: @iDokumentablagetypNr int
-- Gets: @iDokumentNr int
-- Gets: @sAblageort varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Gets: @iMandantNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_DokumentAblageort_Insert]
	@iDokumentablageortNr int,
	@iDokumentablagetypNr int,
	@iDokumentNr int,
	@sAblageort varchar(255),
	@sBeschreibung varchar(255),
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iMandantNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[LC_DokumentAblageort]
(
	[DokumentablageortNr],
	[DokumentablagetypNr],
	[DokumentNr],
	[Ablageort],
	[Beschreibung],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[MandantNr]
)
VALUES
(
	@iDokumentablageortNr,
	@iDokumentablagetypNr,
	@iDokumentNr,
	@sAblageort,
	@sBeschreibung,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@bAktiv,
	@iMandantNr
)
-- 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_LC_DokumentAblageort_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_DokumentAblageort_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'LC_DokumentAblageort'
-- Gets: @iDokumentablageortNr int
-- Gets: @iDokumentablagetypNr int
-- Gets: @iDokumentNr int
-- Gets: @sAblageort varchar(255)
-- Gets: @sBeschreibung varchar(255)
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Gets: @iMandantNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_DokumentAblageort_Update]
	@iDokumentablageortNr int,
	@iDokumentablagetypNr int,
	@iDokumentNr int,
	@sAblageort varchar(255),
	@sBeschreibung varchar(255),
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iMandantNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[LC_DokumentAblageort]
SET 
	[DokumentablagetypNr] = @iDokumentablagetypNr,
	[DokumentNr] = @iDokumentNr,
	[Ablageort] = @sAblageort,
	[Beschreibung] = @sBeschreibung,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[Aktiv] = @bAktiv,
	[MandantNr] = @iMandantNr
WHERE
	[DokumentablageortNr] = @iDokumentablageortNr
-- 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_LC_DokumentAblageort_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_DokumentAblageort_Delete]
GO

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

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'LC_DokumentAblageort'
-- based on the Primary Key.
-- Gets: @iDokumentablageortNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_DokumentAblageort_SelectOne]
	@iDokumentablageortNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[DokumentablageortNr],
	[DokumentablagetypNr],
	[DokumentNr],
	[Ablageort],
	[Beschreibung],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[MandantNr]
FROM [dbo].[LC_DokumentAblageort]
WHERE
	[DokumentablageortNr] = @iDokumentablageortNr
-- 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_LC_DokumentAblageort_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_DokumentAblageort_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'LC_DokumentAblageort'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_DokumentAblageort_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[DokumentablageortNr],
	[DokumentablagetypNr],
	[DokumentNr],
	[Ablageort],
	[Beschreibung],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[MandantNr]
FROM [dbo].[LC_DokumentAblageort]
ORDER BY 
	[DokumentablageortNr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'LC_DokumentAblageTyp'
-- Gets: @iDokumentAblageTypNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Gets: @iMandantNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_DokumentAblageTyp_Insert]
	@iDokumentAblageTypNr int,
	@sBezeichnung varchar(255),
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iMandantNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[LC_DokumentAblageTyp]
(
	[DokumentAblageTypNr],
	[Bezeichnung],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[MandantNr]
)
VALUES
(
	@iDokumentAblageTypNr,
	@sBezeichnung,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@bAktiv,
	@iMandantNr
)
-- 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_LC_DokumentAblageTyp_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_DokumentAblageTyp_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'LC_DokumentAblageTyp'
-- Gets: @iDokumentAblageTypNr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Gets: @iMandantNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_DokumentAblageTyp_Update]
	@iDokumentAblageTypNr int,
	@sBezeichnung varchar(255),
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iMandantNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[LC_DokumentAblageTyp]
SET 
	[Bezeichnung] = @sBezeichnung,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[Aktiv] = @bAktiv,
	[MandantNr] = @iMandantNr
WHERE
	[DokumentAblageTypNr] = @iDokumentAblageTypNr
-- 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_LC_DokumentAblageTyp_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_DokumentAblageTyp_Delete]
GO

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

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'LC_DokumentAblageTyp'
-- based on the Primary Key.
-- Gets: @iDokumentAblageTypNr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_DokumentAblageTyp_SelectOne]
	@iDokumentAblageTypNr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[DokumentAblageTypNr],
	[Bezeichnung],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv],
	[MandantNr]
FROM [dbo].[LC_DokumentAblageTyp]
WHERE
	[DokumentAblageTypNr] = @iDokumentAblageTypNr
-- 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_LC_DokumentAblageTyp_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_DokumentAblageTyp_SelectAll]
GO

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


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

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'LC_Dokumenttyp'
-- Gets: @iDokumenttypnr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_Dokumenttyp_Insert]
	@iDokumenttypnr int,
	@sBezeichnung varchar(255),
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[LC_Dokumenttyp]
(
	[Dokumenttypnr],
	[Bezeichnung],
	[Erstellt_am],
	[Mutiert_am],
	[Mutierer],
	[Aktiv]
)
VALUES
(
	@iDokumenttypnr,
	@sBezeichnung,
	@daErstellt_am,
	@daMutiert_am,
	@iMutierer,
	@bAktiv
)
-- 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_LC_Dokumenttyp_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_Dokumenttyp_Update]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'LC_Dokumenttyp'
-- Gets: @iDokumenttypnr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @daErstellt_am datetime
-- Gets: @daMutiert_am datetime
-- Gets: @iMutierer int
-- Gets: @bAktiv bit
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_LC_Dokumenttyp_Update]
	@iDokumenttypnr int,
	@sBezeichnung varchar(255),
	@daErstellt_am datetime,
	@daMutiert_am datetime,
	@iMutierer int,
	@bAktiv bit,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[LC_Dokumenttyp]
SET 
	[Bezeichnung] = @sBezeichnung,
	[Erstellt_am] = @daErstellt_am,
	[Mutiert_am] = @daMutiert_am,
	[Mutierer] = @iMutierer,
	[Aktiv] = @bAktiv
WHERE
	[Dokumenttypnr] = @iDokumenttypnr
-- 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_LC_Dokumenttyp_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_LC_Dokumenttyp_Delete]
GO

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

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

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


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