USE [Vertragsverwaltung_20160404] GO /****** Object: StoredProcedure [dbo].[pr_History_Insert] Script Date: 02.12.2016 09:08:54 ******/ DROP PROCEDURE [dbo].[pr_History_Insert] GO /****** Object: StoredProcedure [dbo].[pr_History_Insert] Script Date: 02.12.2016 09:08:54 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --------------------------------------------------------------------------------- -- Stored procedure that will insert 1 row in the table 'History' -- Gets: @iHistoryTypNr int -- Gets: @sHistoryObject varchar(50) -- Gets: @sHistoryObjekctKey varchar(50) -- Gets: @sHistoryObjectDetails varchar(50) -- Gets: @sAlter_Wert varchar(50) -- Gets: @sNeuer_Wert varchar(50) -- Gets: @daErstellt_am datetime -- Gets: @iMutierer int -- Returns: @iHistoryNr int -- Returns: @iErrorCode int --------------------------------------------------------------------------------- CREATE PROCEDURE [dbo].[pr_History_Insert] @iHistoryTypNr int, @sHistoryObject varchar(50), @sHistoryObjekctKey varchar(50), @sHistoryObjectDetails varchar(50), @sAlter_Wert varchar(50), @sNeuer_Wert varchar(50), @daErstellt_am datetime, @iMutierer int, @iHistoryNr int OUTPUT, @iErrorCode int OUTPUT AS SET NOCOUNT ON -- INSERT a new row in the table. INSERT [dbo].[History] ( [HistoryTypNr], [HistoryObject], [HistoryObjekctKey], [HistoryObjectDetails], [Alter_Wert], [Neuer_Wert], [Erstellt_am], [Mutierer] ) VALUES ( @iHistoryTypNr, @sHistoryObject, @sHistoryObjekctKey, @sHistoryObjectDetails, @sAlter_Wert, @sNeuer_Wert, @daErstellt_am, @iMutierer ) -- Get the Error Code for the statement just executed. SELECT @iErrorCode=@@ERROR -- Get the IDENTITY value for the row just inserted. SELECT @iHistoryNr=SCOPE_IDENTITY() GO