-- ================================================================================================================
-- Stored Procedures generated by LLBLGen v1.21.2003.712 Final on Sonntag, 19. September 2010, 09:41:03
-- For the Low Level Business Logic Layer for the database 'edoka_journale'
-- ================================================================================================================
SET NOCOUNT ON
GO
USE [edoka_journale]
GO

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

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

---------------------------------------------------------------------------------
-- Stored procedure that will insert 1 row in the table 'Serienbrief_BL_Physiche_Ablage'
-- Gets: @iSerienbriefnr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sTGNumer_Ersteller varchar(50)
-- Gets: @iPartnernr int
-- Gets: @sDokumentid varchar(255)
-- Gets: @daTimestampe datetime
-- Returns: @iEintragnr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Serienbrief_BL_Physiche_Ablage_Insert]
	@iSerienbriefnr int,
	@sBezeichnung varchar(255),
	@sTGNumer_Ersteller varchar(50),
	@iPartnernr int,
	@sDokumentid varchar(255),
	@daTimestampe datetime,
	@iEintragnr int OUTPUT,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- INSERT a new row in the table.
INSERT [dbo].[Serienbrief_BL_Physiche_Ablage]
(
	[Serienbriefnr],
	[Bezeichnung],
	[TGNumer_Ersteller],
	[Partnernr],
	[Dokumentid],
	[Timestampe]
)
VALUES
(
	@iSerienbriefnr,
	@sBezeichnung,
	@sTGNumer_Ersteller,
	@iPartnernr,
	@sDokumentid,
	@daTimestampe
)
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
-- Get the IDENTITY value for the row just inserted.
SELECT @iEintragnr=SCOPE_IDENTITY()
GO


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

---------------------------------------------------------------------------------
-- Stored procedure that will update an existing row in the table 'Serienbrief_BL_Physiche_Ablage'
-- Gets: @iEintragnr int
-- Gets: @iSerienbriefnr int
-- Gets: @sBezeichnung varchar(255)
-- Gets: @sTGNumer_Ersteller varchar(50)
-- Gets: @iPartnernr int
-- Gets: @sDokumentid varchar(255)
-- Gets: @daTimestampe datetime
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Serienbrief_BL_Physiche_Ablage_Update]
	@iEintragnr int,
	@iSerienbriefnr int,
	@sBezeichnung varchar(255),
	@sTGNumer_Ersteller varchar(50),
	@iPartnernr int,
	@sDokumentid varchar(255),
	@daTimestampe datetime,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- UPDATE an existing row in the table.
UPDATE [dbo].[Serienbrief_BL_Physiche_Ablage]
SET 
	[Serienbriefnr] = @iSerienbriefnr,
	[Bezeichnung] = @sBezeichnung,
	[TGNumer_Ersteller] = @sTGNumer_Ersteller,
	[Partnernr] = @iPartnernr,
	[Dokumentid] = @sDokumentid,
	[Timestampe] = @daTimestampe
WHERE
	[Eintragnr] = @iEintragnr
-- 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_Serienbrief_BL_Physiche_Ablage_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Serienbrief_BL_Physiche_Ablage_Delete]
GO

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

---------------------------------------------------------------------------------
-- Stored procedure that will select an existing row from the table 'Serienbrief_BL_Physiche_Ablage'
-- based on the Primary Key.
-- Gets: @iEintragnr int
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Serienbrief_BL_Physiche_Ablage_SelectOne]
	@iEintragnr int,
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT an existing row from the table.
SELECT
	[Eintragnr],
	[Serienbriefnr],
	[Bezeichnung],
	[TGNumer_Ersteller],
	[Partnernr],
	[Dokumentid],
	[Timestampe]
FROM [dbo].[Serienbrief_BL_Physiche_Ablage]
WHERE
	[Eintragnr] = @iEintragnr
-- 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_Serienbrief_BL_Physiche_Ablage_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[pr_Serienbrief_BL_Physiche_Ablage_SelectAll]
GO

---------------------------------------------------------------------------------
-- Stored procedure that will select all rows from the table 'Serienbrief_BL_Physiche_Ablage'
-- Returns: @iErrorCode int
---------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[pr_Serienbrief_BL_Physiche_Ablage_SelectAll]
	@iErrorCode int OUTPUT
AS
SET NOCOUNT ON
-- SELECT all rows from the table.
SELECT
	[Eintragnr],
	[Serienbriefnr],
	[Bezeichnung],
	[TGNumer_Ersteller],
	[Partnernr],
	[Dokumentid],
	[Timestampe]
FROM [dbo].[Serienbrief_BL_Physiche_Ablage]
ORDER BY 
	[Eintragnr] ASC
-- Get the Error Code for the statement just executed.
SELECT @iErrorCode=@@ERROR
GO


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