You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55264 lines
3.6 MiB
55264 lines
3.6 MiB
USE [Vertragsverwaltung_20160404]
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[_applmig] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[_applmig]
|
|
@debug as bit = 1,
|
|
@appl varchar(255)='alle'
|
|
AS
|
|
BEGIN
|
|
declare @applnr int
|
|
declare @bereichnr int
|
|
declare @fachoe int
|
|
declare @techoe int
|
|
declare @kategorie int
|
|
declare @rfcboard int
|
|
|
|
|
|
declare @oappl varchar(255)
|
|
declare @okat varchar(255)
|
|
declare @otechoe varchar(255)
|
|
declare @obereich varchar(255)
|
|
declare @ofachoe varchar(255)
|
|
declare @orfcboard varchar(255)
|
|
declare @error int
|
|
declare xc cursor for
|
|
select applikation,kategorie,[technische Verantwortung neu],[Bereich neu],[fachliche Verantwortung neu],[RFCBoard]
|
|
from [Vertragsverwaltung].[dbo].[__ApplMigData] where applikation=@appl or @appl='alle' order by applikation
|
|
open xc
|
|
fetch next from xc into @oappl, @okat,@otechoe,@obereich,@ofachoe,@orfcboard
|
|
while @@fetch_status=0 begin
|
|
set @error=0
|
|
set @applnr=null
|
|
set @techoe=null
|
|
set @fachoe=null
|
|
set @bereichnr=null
|
|
set @rfcboard=null
|
|
|
|
print 'Applikation: ' + @oappl
|
|
select @applnr=isnull(applikationnr,-1) from applikation where bezeichnung=@oappl
|
|
if @applnr is null begin
|
|
print '--> ' + @oappl + ' nicht vorhanden.'
|
|
set @error=1
|
|
end
|
|
|
|
|
|
--set @okat=SUBSTRING(@okat,6,len(@okat)-5)
|
|
select @kategorie=isnull(Applikationkategorienr,-1) from ApplikationKategorie where Aktiv=1 and Bezeichnung=@okat
|
|
if @kategorie is null begin
|
|
print '--> ' + @okat + ' nicht vorhanden.'
|
|
set @error=1
|
|
end
|
|
|
|
|
|
|
|
SELECT @techoe=isnull(dbo.GremiumGruppierung.GremiumGruppierungNr,-1)
|
|
FROM dbo.Gremium INNER JOIN dbo.GremiumGruppierung ON dbo.Gremium.GremiumNr = dbo.GremiumGruppierung.GremiumNr
|
|
WHERE dbo.GremiumGruppierung.Aktiv = 1 AND dbo.GremiumGruppierung.GremiumNr = 3 and dbo.GremiumGruppierung.Gruppierungsbegriff = @otechoe
|
|
if @techoe is null begin
|
|
print '--> Tech OE nicht gefunden: ' + @otechoe
|
|
set @error=1
|
|
end
|
|
|
|
|
|
SELECT @fachoe=isnull(dbo.GremiumGruppierung.GremiumGruppierungNr,-1)
|
|
FROM dbo.Gremium INNER JOIN dbo.GremiumGruppierung ON dbo.Gremium.GremiumNr = dbo.GremiumGruppierung.GremiumNr
|
|
WHERE dbo.GremiumGruppierung.Aktiv = 1 AND dbo.GremiumGruppierung.GremiumNr = 3 and dbo.GremiumGruppierung.Gruppierungsbegriff = @ofachoe
|
|
if @fachoe is null begin
|
|
print '--> Fach OE nicht gefunden: ' + @ofachoe
|
|
set @error=1
|
|
end
|
|
|
|
|
|
|
|
SELECT @bereichnr=ISNULL(dbo.GremiumGruppierung.GremiumGruppierungNr,-1)
|
|
FROM dbo.Gremium INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Gremium.GremiumNr = dbo.GremiumGruppierung.GremiumNr
|
|
WHERE dbo.GremiumGruppierung.Aktiv = 1 AND dbo.GremiumGruppierung.GremiumNr = 4 and dbo.GremiumGruppierung.Gruppierungsbegriff = @obereich
|
|
if @bereichnr is null begin
|
|
print '--> Bereich nicht gefunden: ' + @obereich
|
|
set @error=1
|
|
end
|
|
|
|
|
|
|
|
if @orfcboard='ANL' set @rfcboard=1
|
|
if @orfcboard='FuR' set @rfcboard=4
|
|
if @orfcboard='FIN' set @rfcboard=5
|
|
if @orfcboard='IT' set @rfcboard=6
|
|
if @orfcboard='SPA' set @rfcboard=102
|
|
if @orfcboard='ZAL' set @rfcboard=103
|
|
|
|
|
|
SELECT @rfcboard=isnull(dbo.GremiumBereich.GremiumBereichNr,-1)
|
|
FROM dbo.GremiumGruppierung INNER JOIN
|
|
dbo.GremiumBereich ON dbo.GremiumGruppierung.GremiumGruppierungNr = dbo.GremiumBereich.GremiumGruppierungNr INNER JOIN
|
|
dbo.Gremium ON dbo.GremiumGruppierung.GremiumNr = dbo.Gremium.GremiumNr
|
|
WHERE dbo.Gremium.GremiumNr = 1 and gremiumbereich.aktiv=1 and dbo.GremiumBereich.Bereich=@orfcboard
|
|
|
|
if @rfcboard is null begin
|
|
print '--> RFCBoard nicht gefunden: ' + @orfcboard
|
|
set @error=1
|
|
end
|
|
|
|
|
|
|
|
if @error = 1 begin
|
|
print '- Error -'
|
|
end
|
|
print ''
|
|
|
|
if @debug=0 and @error=0 begin
|
|
update applikation set rfcboardnr=@rfcboard, applikationkategorienr=@kategorie,
|
|
applikationverantwortungnr=@techoe, fachlicheoe=@fachoe,marktbereichnr=@bereichnr
|
|
where applikationnr=@applnr
|
|
print '--> update durchgeführt'
|
|
end else begin
|
|
if @error=0 and @debug=1 begin
|
|
print '--> ' + @oappl + ' update würde durchgeführt'
|
|
end
|
|
end
|
|
|
|
|
|
fetch next from xc into @oappl, @okat,@otechoe,@obereich,@ofachoe,@orfcboard
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[check_txp_kpi_data_refresh_preconditions] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: Ruedi Schwarzenbach
|
|
-- Create date: 26.02.2016
|
|
-- Description: Prüft ob ein Refresh der Txp Kpi Daten notwendig ist
|
|
-- Design Documentation: "P:\SER\IT\IT-Betrieb\50_Produkte\TicketXpert\Changes
|
|
-- \AT_00044 - Monatlicher Datentransfer ins ITSM\Analyse und Design.docx"
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[check_txp_kpi_data_refresh_preconditions]
|
|
@result INT OUTPUT
|
|
AS
|
|
BEGIN
|
|
-- SET NOCOUNT ON added to prevent extra result sets from
|
|
-- interfering with SELECT statements.
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @status_txp VARCHAR(MAX)
|
|
DECLARE @status_itsm VARCHAR(MAX)
|
|
SET @result= 0
|
|
|
|
DECLARE ctkdrpCursor CURSOR FOR
|
|
SELECT status_txp, status_itsm FROM TXP.dbo._tkb_refresh_kpi_data_time WHERE zeitpunkt = CAST( GETDATE() AS DATE)
|
|
OPEN ctkdrpCursor
|
|
FETCH NEXT FROM ctkdrpCursor into @status_txp, @status_itsm
|
|
IF @@FETCH_STATUS = 0
|
|
BEGIN
|
|
IF @status_txp = 'OK'
|
|
BEGIN
|
|
IF @status_itsm is NULL
|
|
BEGIN
|
|
SET @result= 1
|
|
END
|
|
END
|
|
END
|
|
CLOSE ctkdrpCursor
|
|
DEALLOCATE ctkdrpCursor
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_addtosourcecontrol] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_addtosourcecontrol]
|
|
@vchSourceSafeINI varchar(255) = '',
|
|
@vchProjectName varchar(255) ='',
|
|
@vchComment varchar(255) ='',
|
|
@vchLoginName varchar(255) ='',
|
|
@vchPassword varchar(255) =''
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iReturn int
|
|
declare @iObjectId int
|
|
select @iObjectId = 0
|
|
|
|
declare @iStreamObjectId int
|
|
select @iStreamObjectId = 0
|
|
|
|
declare @VSSGUID varchar(100)
|
|
select @VSSGUID = 'SQLVersionControl.VCS_SQL'
|
|
|
|
declare @vchDatabaseName varchar(255)
|
|
select @vchDatabaseName = db_name()
|
|
|
|
declare @iReturnValue int
|
|
select @iReturnValue = 0
|
|
|
|
declare @iPropertyObjectId int
|
|
declare @vchParentId varchar(255)
|
|
|
|
declare @iObjectCount int
|
|
select @iObjectCount = 0
|
|
|
|
exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
|
|
/* Create Project in SS */
|
|
exec @iReturn = master.dbo.sp_OAMethod @iObjectId,
|
|
'AddProjectToSourceSafe',
|
|
NULL,
|
|
@vchSourceSafeINI,
|
|
@vchProjectName output,
|
|
@@SERVERNAME,
|
|
@vchDatabaseName,
|
|
@vchLoginName,
|
|
@vchPassword,
|
|
@vchComment
|
|
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
/* Set Database Properties */
|
|
|
|
begin tran SetProperties
|
|
|
|
/* add high level object */
|
|
|
|
exec @iPropertyObjectId = dbo.dt_adduserobject_vcs 'VCSProjectID'
|
|
|
|
select @vchParentId = CONVERT(varchar(255),@iPropertyObjectId)
|
|
|
|
exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSProjectID', @vchParentId , NULL
|
|
exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSProject' , @vchProjectName , NULL
|
|
exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSSourceSafeINI' , @vchSourceSafeINI , NULL
|
|
exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSSQLServer', @@SERVERNAME, NULL
|
|
exec dbo.dt_setpropertybyid @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName, NULL
|
|
|
|
if @@error <> 0 GOTO E_General_Error
|
|
|
|
commit tran SetProperties
|
|
|
|
select @iObjectCount = 0;
|
|
|
|
CleanUp:
|
|
select @vchProjectName
|
|
select @iObjectCount
|
|
return
|
|
|
|
E_General_Error:
|
|
/* this is an all or nothing. No specific error messages */
|
|
goto CleanUp
|
|
|
|
E_OAError:
|
|
exec dbo.dt_displayoaerror @iObjectId, @iReturn
|
|
goto CleanUp
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_addtosourcecontrol_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_addtosourcecontrol_u]
|
|
@vchSourceSafeINI nvarchar(255) = '',
|
|
@vchProjectName nvarchar(255) ='',
|
|
@vchComment nvarchar(255) ='',
|
|
@vchLoginName nvarchar(255) ='',
|
|
@vchPassword nvarchar(255) =''
|
|
|
|
as
|
|
-- This procedure should no longer be called; dt_addtosourcecontrol should be called instead.
|
|
-- Calls are forwarded to dt_addtosourcecontrol to maintain backward compatibility
|
|
set nocount on
|
|
exec dbo.dt_addtosourcecontrol
|
|
@vchSourceSafeINI,
|
|
@vchProjectName,
|
|
@vchComment,
|
|
@vchLoginName,
|
|
@vchPassword
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_adduserobject] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Add an object to the dtproperties table
|
|
*/
|
|
create procedure [dbo].[dt_adduserobject]
|
|
as
|
|
set nocount on
|
|
/*
|
|
** Create the user object if it does not exist already
|
|
*/
|
|
begin transaction
|
|
insert dbo.dtproperties (property) VALUES ('DtgSchemaOBJECT')
|
|
update dbo.dtproperties set objectid=@@identity
|
|
where id=@@identity and property='DtgSchemaOBJECT'
|
|
commit
|
|
return @@identity
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_adduserobject_vcs] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create procedure [dbo].[dt_adduserobject_vcs]
|
|
@vchProperty varchar(64)
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iReturn int
|
|
/*
|
|
** Create the user object if it does not exist already
|
|
*/
|
|
begin transaction
|
|
select @iReturn = objectid from dbo.dtproperties where property = @vchProperty
|
|
if @iReturn IS NULL
|
|
begin
|
|
insert dbo.dtproperties (property) VALUES (@vchProperty)
|
|
update dbo.dtproperties set objectid=@@identity
|
|
where id=@@identity and property=@vchProperty
|
|
select @iReturn = @@identity
|
|
end
|
|
commit
|
|
return @iReturn
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_checkinobject] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_checkinobject]
|
|
@chObjectType char(4),
|
|
@vchObjectName varchar(255),
|
|
@vchComment varchar(255)='',
|
|
@vchLoginName varchar(255),
|
|
@vchPassword varchar(255)='',
|
|
@iVCSFlags int = 0,
|
|
@iActionFlag int = 0, /* 0 => AddFile, 1 => CheckIn */
|
|
@txStream1 Text = '', /* drop stream */ /* There is a bug that if items are NULL they do not pass to OLE servers */
|
|
@txStream2 Text = '', /* create stream */
|
|
@txStream3 Text = '' /* grant stream */
|
|
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iReturn int
|
|
declare @iObjectId int
|
|
select @iObjectId = 0
|
|
declare @iStreamObjectId int
|
|
|
|
declare @VSSGUID varchar(100)
|
|
select @VSSGUID = 'SQLVersionControl.VCS_SQL'
|
|
|
|
declare @iPropertyObjectId int
|
|
select @iPropertyObjectId = 0
|
|
|
|
select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID')
|
|
|
|
declare @vchProjectName varchar(255)
|
|
declare @vchSourceSafeINI varchar(255)
|
|
declare @vchServerName varchar(255)
|
|
declare @vchDatabaseName varchar(255)
|
|
declare @iReturnValue int
|
|
declare @pos int
|
|
declare @vchProcLinePiece varchar(255)
|
|
|
|
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT
|
|
|
|
if @chObjectType = 'PROC'
|
|
begin
|
|
if @iActionFlag = 1
|
|
begin
|
|
/* Procedure Can have up to three streams
|
|
Drop Stream, Create Stream, GRANT stream */
|
|
|
|
begin tran compile_all
|
|
|
|
/* try to compile the streams */
|
|
exec (@txStream1)
|
|
if @@error <> 0 GOTO E_Compile_Fail
|
|
|
|
exec (@txStream2)
|
|
if @@error <> 0 GOTO E_Compile_Fail
|
|
|
|
exec (@txStream3)
|
|
if @@error <> 0 GOTO E_Compile_Fail
|
|
end
|
|
|
|
exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
exec @iReturn = master.dbo.sp_OAGetProperty @iObjectId, 'GetStreamObject', @iStreamObjectId OUT
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
if @iActionFlag = 1
|
|
begin
|
|
|
|
declare @iStreamLength int
|
|
|
|
select @pos=1
|
|
select @iStreamLength = datalength(@txStream2)
|
|
|
|
if @iStreamLength > 0
|
|
begin
|
|
|
|
while @pos < @iStreamLength
|
|
begin
|
|
|
|
select @vchProcLinePiece = substring(@txStream2, @pos, 255)
|
|
|
|
exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'AddStream', @iReturnValue OUT, @vchProcLinePiece
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
select @pos = @pos + 255
|
|
|
|
end
|
|
|
|
exec @iReturn = master.dbo.sp_OAMethod @iObjectId,
|
|
'CheckIn_StoredProcedure',
|
|
NULL,
|
|
@sProjectName = @vchProjectName,
|
|
@sSourceSafeINI = @vchSourceSafeINI,
|
|
@sServerName = @vchServerName,
|
|
@sDatabaseName = @vchDatabaseName,
|
|
@sObjectName = @vchObjectName,
|
|
@sComment = @vchComment,
|
|
@sLoginName = @vchLoginName,
|
|
@sPassword = @vchPassword,
|
|
@iVCSFlags = @iVCSFlags,
|
|
@iActionFlag = @iActionFlag,
|
|
@sStream = ''
|
|
|
|
end
|
|
end
|
|
else
|
|
begin
|
|
|
|
select colid, text into #ProcLines
|
|
from syscomments
|
|
where id = object_id(@vchObjectName)
|
|
order by colid
|
|
|
|
declare @iCurProcLine int
|
|
declare @iProcLines int
|
|
select @iCurProcLine = 1
|
|
select @iProcLines = (select count(*) from #ProcLines)
|
|
while @iCurProcLine <= @iProcLines
|
|
begin
|
|
select @pos = 1
|
|
declare @iCurLineSize int
|
|
select @iCurLineSize = len((select text from #ProcLines where colid = @iCurProcLine))
|
|
while @pos <= @iCurLineSize
|
|
begin
|
|
select @vchProcLinePiece = convert(varchar(255),
|
|
substring((select text from #ProcLines where colid = @iCurProcLine),
|
|
@pos, 255 ))
|
|
exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'AddStream', @iReturnValue OUT, @vchProcLinePiece
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
select @pos = @pos + 255
|
|
end
|
|
select @iCurProcLine = @iCurProcLine + 1
|
|
end
|
|
drop table #ProcLines
|
|
|
|
exec @iReturn = master.dbo.sp_OAMethod @iObjectId,
|
|
'CheckIn_StoredProcedure',
|
|
NULL,
|
|
@sProjectName = @vchProjectName,
|
|
@sSourceSafeINI = @vchSourceSafeINI,
|
|
@sServerName = @vchServerName,
|
|
@sDatabaseName = @vchDatabaseName,
|
|
@sObjectName = @vchObjectName,
|
|
@sComment = @vchComment,
|
|
@sLoginName = @vchLoginName,
|
|
@sPassword = @vchPassword,
|
|
@iVCSFlags = @iVCSFlags,
|
|
@iActionFlag = @iActionFlag,
|
|
@sStream = ''
|
|
end
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
if @iActionFlag = 1
|
|
begin
|
|
commit tran compile_all
|
|
if @@error <> 0 GOTO E_Compile_Fail
|
|
end
|
|
|
|
end
|
|
|
|
CleanUp:
|
|
return
|
|
|
|
E_Compile_Fail:
|
|
declare @lerror int
|
|
select @lerror = @@error
|
|
rollback tran compile_all
|
|
RAISERROR (@lerror,16,-1)
|
|
goto CleanUp
|
|
|
|
E_OAError:
|
|
if @iActionFlag = 1 rollback tran compile_all
|
|
exec dbo.dt_displayoaerror @iObjectId, @iReturn
|
|
goto CleanUp
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_checkinobject_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_checkinobject_u]
|
|
@chObjectType char(4),
|
|
@vchObjectName nvarchar(255),
|
|
@vchComment nvarchar(255)='',
|
|
@vchLoginName nvarchar(255),
|
|
@vchPassword nvarchar(255)='',
|
|
@iVCSFlags int = 0,
|
|
@iActionFlag int = 0, /* 0 => AddFile, 1 => CheckIn */
|
|
@txStream1 text = '', /* drop stream */ /* There is a bug that if items are NULL they do not pass to OLE servers */
|
|
@txStream2 text = '', /* create stream */
|
|
@txStream3 text = '' /* grant stream */
|
|
|
|
as
|
|
-- This procedure should no longer be called; dt_checkinobject should be called instead.
|
|
-- Calls are forwarded to dt_checkinobject to maintain backward compatibility.
|
|
set nocount on
|
|
exec dbo.dt_checkinobject
|
|
@chObjectType,
|
|
@vchObjectName,
|
|
@vchComment,
|
|
@vchLoginName,
|
|
@vchPassword,
|
|
@iVCSFlags,
|
|
@iActionFlag,
|
|
@txStream1,
|
|
@txStream2,
|
|
@txStream3
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_checkoutobject] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_checkoutobject]
|
|
@chObjectType char(4),
|
|
@vchObjectName varchar(255),
|
|
@vchComment varchar(255),
|
|
@vchLoginName varchar(255),
|
|
@vchPassword varchar(255),
|
|
@iVCSFlags int = 0,
|
|
@iActionFlag int = 0/* 0 => Checkout, 1 => GetLatest, 2 => UndoCheckOut */
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iReturn int
|
|
declare @iObjectId int
|
|
select @iObjectId =0
|
|
|
|
declare @VSSGUID varchar(100)
|
|
select @VSSGUID = 'SQLVersionControl.VCS_SQL'
|
|
|
|
declare @iReturnValue int
|
|
select @iReturnValue = 0
|
|
|
|
declare @vchTempText varchar(255)
|
|
|
|
/* this is for our strings */
|
|
declare @iStreamObjectId int
|
|
select @iStreamObjectId = 0
|
|
|
|
declare @iPropertyObjectId int
|
|
select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID')
|
|
|
|
declare @vchProjectName varchar(255)
|
|
declare @vchSourceSafeINI varchar(255)
|
|
declare @vchServerName varchar(255)
|
|
declare @vchDatabaseName varchar(255)
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT
|
|
|
|
if @chObjectType = 'PROC'
|
|
begin
|
|
/* Procedure Can have up to three streams
|
|
Drop Stream, Create Stream, GRANT stream */
|
|
|
|
exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
exec @iReturn = master.dbo.sp_OAMethod @iObjectId,
|
|
'CheckOut_StoredProcedure',
|
|
NULL,
|
|
@sProjectName = @vchProjectName,
|
|
@sSourceSafeINI = @vchSourceSafeINI,
|
|
@sObjectName = @vchObjectName,
|
|
@sServerName = @vchServerName,
|
|
@sDatabaseName = @vchDatabaseName,
|
|
@sComment = @vchComment,
|
|
@sLoginName = @vchLoginName,
|
|
@sPassword = @vchPassword,
|
|
@iVCSFlags = @iVCSFlags,
|
|
@iActionFlag = @iActionFlag
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
|
|
exec @iReturn = master.dbo.sp_OAGetProperty @iObjectId, 'GetStreamObject', @iStreamObjectId OUT
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
create table #commenttext (id int identity, sourcecode varchar(255))
|
|
|
|
|
|
select @vchTempText = 'STUB'
|
|
while @vchTempText is not null
|
|
begin
|
|
exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'GetStream', @iReturnValue OUT, @vchTempText OUT
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
if (@vchTempText = '') set @vchTempText = null
|
|
if (@vchTempText is not null) insert into #commenttext (sourcecode) select @vchTempText
|
|
end
|
|
|
|
select 'VCS'=sourcecode from #commenttext order by id
|
|
select 'SQL'=text from syscomments where id = object_id(@vchObjectName) order by colid
|
|
|
|
end
|
|
|
|
CleanUp:
|
|
return
|
|
|
|
E_OAError:
|
|
exec dbo.dt_displayoaerror @iObjectId, @iReturn
|
|
GOTO CleanUp
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_checkoutobject_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_checkoutobject_u]
|
|
@chObjectType char(4),
|
|
@vchObjectName nvarchar(255),
|
|
@vchComment nvarchar(255),
|
|
@vchLoginName nvarchar(255),
|
|
@vchPassword nvarchar(255),
|
|
@iVCSFlags int = 0,
|
|
@iActionFlag int = 0/* 0 => Checkout, 1 => GetLatest, 2 => UndoCheckOut */
|
|
|
|
as
|
|
|
|
-- This procedure should no longer be called; dt_checkoutobject should be called instead.
|
|
-- Calls are forwarded to dt_checkoutobject to maintain backward compatibility.
|
|
set nocount on
|
|
exec dbo.dt_checkoutobject
|
|
@chObjectType,
|
|
@vchObjectName,
|
|
@vchComment,
|
|
@vchLoginName,
|
|
@vchPassword,
|
|
@iVCSFlags,
|
|
@iActionFlag
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_displayoaerror] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[dt_displayoaerror]
|
|
@iObject int,
|
|
@iresult int
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @vchOutput varchar(255)
|
|
declare @hr int
|
|
declare @vchSource varchar(255)
|
|
declare @vchDescription varchar(255)
|
|
|
|
exec @hr = master.dbo.sp_OAGetErrorInfo @iObject, @vchSource OUT, @vchDescription OUT
|
|
|
|
select @vchOutput = @vchSource + ': ' + @vchDescription
|
|
raiserror (@vchOutput,16,-1)
|
|
|
|
return
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_displayoaerror_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[dt_displayoaerror_u]
|
|
@iObject int,
|
|
@iresult int
|
|
as
|
|
-- This procedure should no longer be called; dt_displayoaerror should be called instead.
|
|
-- Calls are forwarded to dt_displayoaerror to maintain backward compatibility.
|
|
set nocount on
|
|
exec dbo.dt_displayoaerror
|
|
@iObject,
|
|
@iresult
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_droppropertiesbyid] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Drop one or all the associated properties of an object or an attribute
|
|
**
|
|
** dt_dropproperties objid, null or '' -- drop all properties of the object itself
|
|
** dt_dropproperties objid, property -- drop the property
|
|
*/
|
|
create procedure [dbo].[dt_droppropertiesbyid]
|
|
@id int,
|
|
@property varchar(64)
|
|
as
|
|
set nocount on
|
|
|
|
if (@property is null) or (@property = '')
|
|
delete from dbo.dtproperties where objectid=@id
|
|
else
|
|
delete from dbo.dtproperties
|
|
where objectid=@id and property=@property
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_dropuserobjectbyid] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Drop an object from the dbo.dtproperties table
|
|
*/
|
|
create procedure [dbo].[dt_dropuserobjectbyid]
|
|
@id int
|
|
as
|
|
set nocount on
|
|
delete from dbo.dtproperties where objectid=@id
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_generateansiname] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Generate an ansi name that is unique in the dtproperties.value column
|
|
*/
|
|
create procedure [dbo].[dt_generateansiname](@name varchar(255) output)
|
|
as
|
|
declare @prologue varchar(20)
|
|
declare @indexstring varchar(20)
|
|
declare @index integer
|
|
|
|
set @prologue = 'MSDT-A-'
|
|
set @index = 1
|
|
|
|
while 1 = 1
|
|
begin
|
|
set @indexstring = cast(@index as varchar(20))
|
|
set @name = @prologue + @indexstring
|
|
if not exists (select value from dtproperties where value = @name)
|
|
break
|
|
|
|
set @index = @index + 1
|
|
|
|
if (@index = 10000)
|
|
goto TooMany
|
|
end
|
|
|
|
Leave:
|
|
|
|
return
|
|
|
|
TooMany:
|
|
|
|
set @name = 'DIAGRAM'
|
|
goto Leave
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_getobjwithprop] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Retrieve the owner object(s) of a given property
|
|
*/
|
|
create procedure [dbo].[dt_getobjwithprop]
|
|
@property varchar(30),
|
|
@value varchar(255)
|
|
as
|
|
set nocount on
|
|
|
|
if (@property is null) or (@property = '')
|
|
begin
|
|
raiserror('Must specify a property name.',-1,-1)
|
|
return (1)
|
|
end
|
|
|
|
if (@value is null)
|
|
select objectid id from dbo.dtproperties
|
|
where property=@property
|
|
|
|
else
|
|
select objectid id from dbo.dtproperties
|
|
where property=@property and value=@value
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_getobjwithprop_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Retrieve the owner object(s) of a given property
|
|
*/
|
|
create procedure [dbo].[dt_getobjwithprop_u]
|
|
@property varchar(30),
|
|
@uvalue nvarchar(255)
|
|
as
|
|
set nocount on
|
|
|
|
if (@property is null) or (@property = '')
|
|
begin
|
|
raiserror('Must specify a property name.',-1,-1)
|
|
return (1)
|
|
end
|
|
|
|
if (@uvalue is null)
|
|
select objectid id from dbo.dtproperties
|
|
where property=@property
|
|
|
|
else
|
|
select objectid id from dbo.dtproperties
|
|
where property=@property and uvalue=@uvalue
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Retrieve properties by id's
|
|
**
|
|
** dt_getproperties objid, null or '' -- retrieve all properties of the object itself
|
|
** dt_getproperties objid, property -- retrieve the property specified
|
|
*/
|
|
create procedure [dbo].[dt_getpropertiesbyid]
|
|
@id int,
|
|
@property varchar(64)
|
|
as
|
|
set nocount on
|
|
|
|
if (@property is null) or (@property = '')
|
|
select property, version, value, lvalue
|
|
from dbo.dtproperties
|
|
where @id=objectid
|
|
else
|
|
select property, version, value, lvalue
|
|
from dbo.dtproperties
|
|
where @id=objectid and @property=property
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** Retrieve properties by id's
|
|
**
|
|
** dt_getproperties objid, null or '' -- retrieve all properties of the object itself
|
|
** dt_getproperties objid, property -- retrieve the property specified
|
|
*/
|
|
create procedure [dbo].[dt_getpropertiesbyid_u]
|
|
@id int,
|
|
@property varchar(64)
|
|
as
|
|
set nocount on
|
|
|
|
if (@property is null) or (@property = '')
|
|
select property, version, uvalue, lvalue
|
|
from dbo.dtproperties
|
|
where @id=objectid
|
|
else
|
|
select property, version, uvalue, lvalue
|
|
from dbo.dtproperties
|
|
where @id=objectid and @property=property
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid_vcs] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create procedure [dbo].[dt_getpropertiesbyid_vcs]
|
|
@id int,
|
|
@property varchar(64),
|
|
@value varchar(255) = NULL OUT
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
select @value = (
|
|
select value
|
|
from dbo.dtproperties
|
|
where @id=objectid and @property=property
|
|
)
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_getpropertiesbyid_vcs_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create procedure [dbo].[dt_getpropertiesbyid_vcs_u]
|
|
@id int,
|
|
@property varchar(64),
|
|
@value nvarchar(255) = NULL OUT
|
|
|
|
as
|
|
|
|
-- This procedure should no longer be called; dt_getpropertiesbyid_vcsshould be called instead.
|
|
-- Calls are forwarded to dt_getpropertiesbyid_vcs to maintain backward compatibility.
|
|
set nocount on
|
|
exec dbo.dt_getpropertiesbyid_vcs
|
|
@id,
|
|
@property,
|
|
@value output
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_isundersourcecontrol] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_isundersourcecontrol]
|
|
@vchLoginName varchar(255) = '',
|
|
@vchPassword varchar(255) = '',
|
|
@iWhoToo int = 0 /* 0 => Just check project; 1 => get list of objs */
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iReturn int
|
|
declare @iObjectId int
|
|
select @iObjectId = 0
|
|
|
|
declare @VSSGUID varchar(100)
|
|
select @VSSGUID = 'SQLVersionControl.VCS_SQL'
|
|
|
|
declare @iReturnValue int
|
|
select @iReturnValue = 0
|
|
|
|
declare @iStreamObjectId int
|
|
select @iStreamObjectId = 0
|
|
|
|
declare @vchTempText varchar(255)
|
|
|
|
declare @iPropertyObjectId int
|
|
select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID')
|
|
|
|
declare @vchProjectName varchar(255)
|
|
declare @vchSourceSafeINI varchar(255)
|
|
declare @vchServerName varchar(255)
|
|
declare @vchDatabaseName varchar(255)
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT
|
|
|
|
if (@vchProjectName = '') set @vchProjectName = null
|
|
if (@vchSourceSafeINI = '') set @vchSourceSafeINI = null
|
|
if (@vchServerName = '') set @vchServerName = null
|
|
if (@vchDatabaseName = '') set @vchDatabaseName = null
|
|
|
|
if (@vchProjectName is null) or (@vchSourceSafeINI is null) or (@vchServerName is null) or (@vchDatabaseName is null)
|
|
begin
|
|
RAISERROR('Not Under Source Control',16,-1)
|
|
return
|
|
end
|
|
|
|
if @iWhoToo = 1
|
|
begin
|
|
|
|
/* Get List of Procs in the project */
|
|
exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
exec @iReturn = master.dbo.sp_OAMethod @iObjectId,
|
|
'GetListOfObjects',
|
|
NULL,
|
|
@vchProjectName,
|
|
@vchSourceSafeINI,
|
|
@vchServerName,
|
|
@vchDatabaseName,
|
|
@vchLoginName,
|
|
@vchPassword
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
exec @iReturn = master.dbo.sp_OAGetProperty @iObjectId, 'GetStreamObject', @iStreamObjectId OUT
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
create table #ObjectList (id int identity, vchObjectlist varchar(255))
|
|
|
|
select @vchTempText = 'STUB'
|
|
while @vchTempText is not null
|
|
begin
|
|
exec @iReturn = master.dbo.sp_OAMethod @iStreamObjectId, 'GetStream', @iReturnValue OUT, @vchTempText OUT
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
if (@vchTempText = '') set @vchTempText = null
|
|
if (@vchTempText is not null) insert into #ObjectList (vchObjectlist ) select @vchTempText
|
|
end
|
|
|
|
select vchObjectlist from #ObjectList order by id
|
|
end
|
|
|
|
CleanUp:
|
|
return
|
|
|
|
E_OAError:
|
|
exec dbo.dt_displayoaerror @iObjectId, @iReturn
|
|
goto CleanUp
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_isundersourcecontrol_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_isundersourcecontrol_u]
|
|
@vchLoginName nvarchar(255) = '',
|
|
@vchPassword nvarchar(255) = '',
|
|
@iWhoToo int = 0 /* 0 => Just check project; 1 => get list of objs */
|
|
|
|
as
|
|
-- This procedure should no longer be called; dt_isundersourcecontrol should be called instead.
|
|
-- Calls are forwarded to dt_isundersourcecontrol to maintain backward compatibility.
|
|
set nocount on
|
|
exec dbo.dt_isundersourcecontrol
|
|
@vchLoginName,
|
|
@vchPassword,
|
|
@iWhoToo
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_removefromsourcecontrol] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create procedure [dbo].[dt_removefromsourcecontrol]
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iPropertyObjectId int
|
|
select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID')
|
|
|
|
exec dbo.dt_droppropertiesbyid @iPropertyObjectId, null
|
|
|
|
/* -1 is returned by dt_droppopertiesbyid */
|
|
if @@error <> 0 and @@error <> -1 return 1
|
|
|
|
return 0
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_setpropertybyid] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** If the property already exists, reset the value; otherwise add property
|
|
** id -- the id in sysobjects of the object
|
|
** property -- the name of the property
|
|
** value -- the text value of the property
|
|
** lvalue -- the binary value of the property (image)
|
|
*/
|
|
create procedure [dbo].[dt_setpropertybyid]
|
|
@id int,
|
|
@property varchar(64),
|
|
@value varchar(255),
|
|
@lvalue image
|
|
as
|
|
set nocount on
|
|
declare @uvalue nvarchar(255)
|
|
set @uvalue = convert(nvarchar(255), @value)
|
|
if exists (select * from dbo.dtproperties
|
|
where objectid=@id and property=@property)
|
|
begin
|
|
--
|
|
-- bump the version count for this row as we update it
|
|
--
|
|
update dbo.dtproperties set value=@value, uvalue=@uvalue, lvalue=@lvalue, version=version+1
|
|
where objectid=@id and property=@property
|
|
end
|
|
else
|
|
begin
|
|
--
|
|
-- version count is auto-set to 0 on initial insert
|
|
--
|
|
insert dbo.dtproperties (property, objectid, value, uvalue, lvalue)
|
|
values (@property, @id, @value, @uvalue, @lvalue)
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_setpropertybyid_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** If the property already exists, reset the value; otherwise add property
|
|
** id -- the id in sysobjects of the object
|
|
** property -- the name of the property
|
|
** uvalue -- the text value of the property
|
|
** lvalue -- the binary value of the property (image)
|
|
*/
|
|
create procedure [dbo].[dt_setpropertybyid_u]
|
|
@id int,
|
|
@property varchar(64),
|
|
@uvalue nvarchar(255),
|
|
@lvalue image
|
|
as
|
|
set nocount on
|
|
--
|
|
-- If we are writing the name property, find the ansi equivalent.
|
|
-- If there is no lossless translation, generate an ansi name.
|
|
--
|
|
declare @avalue varchar(255)
|
|
set @avalue = null
|
|
if (@uvalue is not null)
|
|
begin
|
|
if (convert(nvarchar(255), convert(varchar(255), @uvalue)) = @uvalue)
|
|
begin
|
|
set @avalue = convert(varchar(255), @uvalue)
|
|
end
|
|
else
|
|
begin
|
|
if 'DtgSchemaNAME' = @property
|
|
begin
|
|
exec dbo.dt_generateansiname @avalue output
|
|
end
|
|
end
|
|
end
|
|
if exists (select * from dbo.dtproperties
|
|
where objectid=@id and property=@property)
|
|
begin
|
|
--
|
|
-- bump the version count for this row as we update it
|
|
--
|
|
update dbo.dtproperties set value=@avalue, uvalue=@uvalue, lvalue=@lvalue, version=version+1
|
|
where objectid=@id and property=@property
|
|
end
|
|
else
|
|
begin
|
|
--
|
|
-- version count is auto-set to 0 on initial insert
|
|
--
|
|
insert dbo.dtproperties (property, objectid, value, uvalue, lvalue)
|
|
values (@property, @id, @avalue, @uvalue, @lvalue)
|
|
end
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_validateloginparams] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_validateloginparams]
|
|
@vchLoginName varchar(255),
|
|
@vchPassword varchar(255)
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iReturn int
|
|
declare @iObjectId int
|
|
select @iObjectId =0
|
|
|
|
declare @VSSGUID varchar(100)
|
|
select @VSSGUID = 'SQLVersionControl.VCS_SQL'
|
|
|
|
declare @iPropertyObjectId int
|
|
select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID')
|
|
|
|
declare @vchSourceSafeINI varchar(255)
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT
|
|
|
|
exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
exec @iReturn = master.dbo.sp_OAMethod @iObjectId,
|
|
'ValidateLoginParams',
|
|
NULL,
|
|
@sSourceSafeINI = @vchSourceSafeINI,
|
|
@sLoginName = @vchLoginName,
|
|
@sPassword = @vchPassword
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
CleanUp:
|
|
return
|
|
|
|
E_OAError:
|
|
exec dbo.dt_displayoaerror @iObjectId, @iReturn
|
|
GOTO CleanUp
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_validateloginparams_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_validateloginparams_u]
|
|
@vchLoginName nvarchar(255),
|
|
@vchPassword nvarchar(255)
|
|
as
|
|
|
|
-- This procedure should no longer be called; dt_validateloginparams should be called instead.
|
|
-- Calls are forwarded to dt_validateloginparams to maintain backward compatibility.
|
|
set nocount on
|
|
exec dbo.dt_validateloginparams
|
|
@vchLoginName,
|
|
@vchPassword
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_vcsenabled] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_vcsenabled]
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iObjectId int
|
|
select @iObjectId = 0
|
|
|
|
declare @VSSGUID varchar(100)
|
|
select @VSSGUID = 'SQLVersionControl.VCS_SQL'
|
|
|
|
declare @iReturn int
|
|
exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT
|
|
if @iReturn <> 0 raiserror('', 16, -1) /* Can't Load Helper DLLC */
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_verstamp006] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** This procedure returns the version number of the stored
|
|
** procedures used by legacy versions of the Microsoft
|
|
** Visual Database Tools. Version is 7.0.00.
|
|
*/
|
|
create procedure [dbo].[dt_verstamp006]
|
|
as
|
|
select 7000
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_verstamp007] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
/*
|
|
** This procedure returns the version number of the stored
|
|
** procedures used by the the Microsoft Visual Database Tools.
|
|
** Version is 7.0.05.
|
|
*/
|
|
create procedure [dbo].[dt_verstamp007]
|
|
as
|
|
select 7005
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_whocheckedout] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_whocheckedout]
|
|
@chObjectType char(4),
|
|
@vchObjectName varchar(255),
|
|
@vchLoginName varchar(255),
|
|
@vchPassword varchar(255)
|
|
|
|
as
|
|
|
|
set nocount on
|
|
|
|
declare @iReturn int
|
|
declare @iObjectId int
|
|
select @iObjectId =0
|
|
|
|
declare @VSSGUID varchar(100)
|
|
select @VSSGUID = 'SQLVersionControl.VCS_SQL'
|
|
|
|
declare @iPropertyObjectId int
|
|
|
|
select @iPropertyObjectId = (select objectid from dbo.dtproperties where property = 'VCSProjectID')
|
|
|
|
declare @vchProjectName varchar(255)
|
|
declare @vchSourceSafeINI varchar(255)
|
|
declare @vchServerName varchar(255)
|
|
declare @vchDatabaseName varchar(255)
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSProject', @vchProjectName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSourceSafeINI', @vchSourceSafeINI OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLServer', @vchServerName OUT
|
|
exec dbo.dt_getpropertiesbyid_vcs @iPropertyObjectId, 'VCSSQLDatabase', @vchDatabaseName OUT
|
|
|
|
if @chObjectType = 'PROC'
|
|
begin
|
|
exec @iReturn = master.dbo.sp_OACreate @VSSGUID, @iObjectId OUT
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
declare @vchReturnValue varchar(255)
|
|
select @vchReturnValue = ''
|
|
|
|
exec @iReturn = master.dbo.sp_OAMethod @iObjectId,
|
|
'WhoCheckedOut',
|
|
@vchReturnValue OUT,
|
|
@sProjectName = @vchProjectName,
|
|
@sSourceSafeINI = @vchSourceSafeINI,
|
|
@sObjectName = @vchObjectName,
|
|
@sServerName = @vchServerName,
|
|
@sDatabaseName = @vchDatabaseName,
|
|
@sLoginName = @vchLoginName,
|
|
@sPassword = @vchPassword
|
|
|
|
if @iReturn <> 0 GOTO E_OAError
|
|
|
|
select @vchReturnValue
|
|
|
|
end
|
|
|
|
CleanUp:
|
|
return
|
|
|
|
E_OAError:
|
|
exec dbo.dt_displayoaerror @iObjectId, @iReturn
|
|
GOTO CleanUp
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[dt_whocheckedout_u] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create proc [dbo].[dt_whocheckedout_u]
|
|
@chObjectType char(4),
|
|
@vchObjectName nvarchar(255),
|
|
@vchLoginName nvarchar(255),
|
|
@vchPassword nvarchar(255)
|
|
|
|
as
|
|
|
|
-- This procedure should no longer be called; dt_whocheckedout should be called instead.
|
|
-- Calls are forwarded to dt_whocheckedout to maintain backward compatibility.
|
|
set nocount on
|
|
exec dbo.dt_whocheckedout
|
|
@chObjectType,
|
|
@vchObjectName,
|
|
@vchLoginName,
|
|
@vchPassword
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[F18] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[F18]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT on
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2015 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '30.05.2015 23:59:59'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 25
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
tgnummer VARCHAR(255) ,
|
|
NAME VARCHAR(255) ,
|
|
kst VARCHAR(255) ,
|
|
akutell FLOAT ,
|
|
projektnr INT ,
|
|
projektname VARCHAR(255)
|
|
)
|
|
DECLARE @tmpb TABLE
|
|
(
|
|
tgnummer VARCHAR(255) ,
|
|
NAME VARCHAR(255) ,
|
|
kst VARCHAR(255) ,
|
|
akutell FLOAT ,
|
|
projektnr INT ,
|
|
projektname VARCHAR(255)
|
|
)
|
|
|
|
|
|
|
|
DECLARE @tmpc TABLE
|
|
(
|
|
[OE] [varchar](50) NULL ,
|
|
[OESort] [int] NULL ,
|
|
[Name] [varchar](50) NULL ,
|
|
[Vorname] [varchar](50) NULL ,
|
|
[Sortierung] [int] NULL ,
|
|
[TGNummer] [varchar](50) NULL ,
|
|
[Sort] [int] NULL ,
|
|
[Engagement_Effektiv] [float] NOT NULL ,
|
|
[PAufwand] [float] NULL ,
|
|
[RFC_300] [float] NULL ,
|
|
[CTB] [float] NULL ,
|
|
[RTB] [float] NULL ,
|
|
[RFC_200] [float] NULL ,
|
|
[Total] [float] NULL ,
|
|
[Soll] [float] NULL ,
|
|
[Prod] [numeric](18, 2) NULL ,
|
|
[Anteil_CTB] [numeric](18, 2) NULL ,
|
|
[Anteil_Rtb] [numeric](18, 2) NULL
|
|
)
|
|
DECLARE @tmpd TABLE
|
|
(
|
|
[OE] [varchar](50) NULL ,
|
|
[OESort] [int] NULL ,
|
|
[Name] [varchar](50) NULL ,
|
|
[Vorname] [varchar](50) NULL ,
|
|
[Sortierung] [int] NULL ,
|
|
[TGNummer] [varchar](50) NULL ,
|
|
[Sort] [int] NULL ,
|
|
[Engagement_Effektiv] [float] NOT NULL ,
|
|
[PAufwand] [float] NULL ,
|
|
[RFC_300] [float] NULL ,
|
|
[CTB] [float] NULL ,
|
|
[RTB] [float] NULL ,
|
|
[RFC_200] [float] NULL ,
|
|
[Total] [float] NULL ,
|
|
[Soll] [float] NULL ,
|
|
[Prod] [numeric](18, 2) NULL ,
|
|
[Anteil_CTB] [numeric](18, 2) NULL ,
|
|
[Anteil_Rtb] [numeric](18, 2) NULL
|
|
)
|
|
|
|
DECLARE @f18 TABLE
|
|
(
|
|
projektnr INT ,
|
|
projektname VARCHAR(255) ,
|
|
aktuell FLOAT ,
|
|
vormonat FLOAT ,
|
|
differenz FLOAT ,
|
|
neu bit ,
|
|
ctb int
|
|
)
|
|
|
|
INSERT @tmpa
|
|
EXEC sp_rpt_fhrlst_projekte_nach_ma @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
--set @von = DATEADD(MONTH,-1,@von)
|
|
SET @bis = DATEADD(MONTH, -1, @bis)
|
|
INSERT @tmpb
|
|
EXEC sp_rpt_fhrlst_projekte_nach_ma @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
|
|
--SELECT projektnr, projektname, ROUND(SUM(akutell)/8,0) FROM @tmpa GROUP BY projektnr, projektname ORDER BY projektnr
|
|
--SELECT projektnr, projektname, ROUND(SUM(akutell)/8,0) FROM @tmpb GROUP BY projektnr, projektname ORDER BY projektnr
|
|
|
|
--set @von = DATEADD(MONTH, +1, @von)
|
|
SET @bis = DATEADD(MONTH, +1, @bis)
|
|
INSERT @tmpc
|
|
EXEC sp_rpt_fhrlst_aufwand @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss,null,'intern'
|
|
--set @von = DATEADD(MONTH, -1, @von)
|
|
SET @bis = DATEADD(MONTH, -1, @bis)
|
|
INSERT @tmpd
|
|
EXEC sp_rpt_fhrlst_aufwand @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss,null,'intern'
|
|
|
|
DECLARE @sum1 FLOAT
|
|
DECLARE @sum2 FLOAT
|
|
|
|
DECLARE @pnr VARCHAR(255)
|
|
DECLARE @pn VARCHAR(255)
|
|
DECLARE @summe FLOAT
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpb
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu )
|
|
VALUES ( @pnr, @pn, 0, @summe, 0, 0 )
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
DECLARE @rc INT
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpa
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM @f18
|
|
WHERE projektnr = @pnr
|
|
IF @rc = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu )
|
|
VALUES ( @pnr, @pn, @summe, 0, 0, 1 )
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
UPDATE @f18
|
|
SET aktuell = @summe
|
|
WHERE projektnr = @pnr
|
|
END
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
SELECT @sum1 = ROUND(SUM(ctb) / 8, 0)
|
|
FROM @tmpc
|
|
SELECT @sum2 = ROUND(SUM(ctb) / 8, 0)
|
|
FROM @tmpd
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu )
|
|
VALUES ( 0, 'AU', @sum1, @sum2, @sum1 - @sum2, 0 )
|
|
|
|
UPDATE @f18
|
|
SET ctb = 1
|
|
|
|
SELECT @sum1 = ROUND(SUM(rtb) / 8, 2)
|
|
FROM @tmpc
|
|
SELECT @sum2 = ROUND(SUM(rtb) / 8, 2)
|
|
FROM @tmpd
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu, ctb )
|
|
VALUES ( 0, 'IN', @sum1, @sum2, @sum1 - @sum2, 0, 0 )
|
|
|
|
|
|
|
|
|
|
|
|
DELETE FROM @tmpa
|
|
DELETE FROM @tmpb
|
|
|
|
--set @von = DATEADD(MONTH, +1, @von)
|
|
SET @bis = DATEADD(MONTH, +1, @bis)
|
|
PRINT @von
|
|
PRINT @bis
|
|
INSERT @tmpa
|
|
EXEC sp_rpt_fhrlst_incidents_nach_ma @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
--set @von = DATEADD(MONTH, -1, @von)
|
|
SET @bis = DATEADD(MONTH, -1, @bis)
|
|
INSERT @tmpb
|
|
EXEC sp_rpt_fhrlst_incidents_nach_ma @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpb
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu,ctb )
|
|
VALUES ( @pnr, @pn, 0, @summe, 0, 0,0 )
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpa
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM @f18
|
|
WHERE projektnr = @pnr
|
|
IF @rc = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu,ctb )
|
|
VALUES ( @pnr, @pn, @summe, 0, 0, 1 ,0)
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
UPDATE @f18
|
|
SET aktuell = @summe
|
|
WHERE projektnr = @pnr
|
|
END
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
UPDATE @f18
|
|
SET differenz = aktuell - vormonat
|
|
|
|
SELECT *
|
|
FROM @f18
|
|
ORDER BY projektnr
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[F24] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[F24]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT on
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '31.05.2013 23:59:59'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 25
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
tgnummer VARCHAR(255) ,
|
|
NAME VARCHAR(255) ,
|
|
kst VARCHAR(255) ,
|
|
akutell FLOAT ,
|
|
projektnr INT ,
|
|
projektname VARCHAR(255)
|
|
)
|
|
DECLARE @tmpb TABLE
|
|
(
|
|
tgnummer VARCHAR(255) ,
|
|
NAME VARCHAR(255) ,
|
|
kst VARCHAR(255) ,
|
|
akutell FLOAT ,
|
|
projektnr INT ,
|
|
projektname VARCHAR(255)
|
|
)
|
|
|
|
|
|
|
|
DECLARE @tmpc TABLE
|
|
(
|
|
[OE] [varchar](50) NULL ,
|
|
[OESort] [int] NULL ,
|
|
[Name] [varchar](50) NULL ,
|
|
[Vorname] [varchar](50) NULL ,
|
|
[Sortierung] [int] NULL ,
|
|
[TGNummer] [varchar](50) NULL ,
|
|
[Sort] [int] NULL ,
|
|
[Engagement_Effektiv] [float] NOT NULL ,
|
|
[PAufwand] [float] NULL ,
|
|
[RFC_300] [float] NULL ,
|
|
[CTB] [float] NULL ,
|
|
[RTB] [float] NULL ,
|
|
[RFC_200] [float] NULL ,
|
|
[Total] [float] NULL ,
|
|
[Soll] [float] NULL ,
|
|
[Prod] [numeric](18, 2) NULL ,
|
|
[Anteil_CTB] [numeric](18, 2) NULL ,
|
|
[Anteil_Rtb] [numeric](18, 2) NULL
|
|
)
|
|
DECLARE @tmpd TABLE
|
|
(
|
|
[OE] [varchar](50) NULL ,
|
|
[OESort] [int] NULL ,
|
|
[Name] [varchar](50) NULL ,
|
|
[Vorname] [varchar](50) NULL ,
|
|
[Sortierung] [int] NULL ,
|
|
[TGNummer] [varchar](50) NULL ,
|
|
[Sort] [int] NULL ,
|
|
[Engagement_Effektiv] [float] NOT NULL ,
|
|
[PAufwand] [float] NULL ,
|
|
[RFC_300] [float] NULL ,
|
|
[CTB] [float] NULL ,
|
|
[RTB] [float] NULL ,
|
|
[RFC_200] [float] NULL ,
|
|
[Total] [float] NULL ,
|
|
[Soll] [float] NULL ,
|
|
[Prod] [numeric](18, 2) NULL ,
|
|
[Anteil_CTB] [numeric](18, 2) NULL ,
|
|
[Anteil_Rtb] [numeric](18, 2) NULL
|
|
)
|
|
|
|
DECLARE @f18 TABLE
|
|
(
|
|
projektnr INT ,
|
|
projektname VARCHAR(255) ,
|
|
aktuell FLOAT ,
|
|
vormonat FLOAT ,
|
|
differenz FLOAT ,
|
|
neu BIT ,
|
|
ctb int
|
|
)
|
|
|
|
INSERT @tmpa
|
|
EXEC sp_rpt_fhrlst_projekte_nach_ma_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
SET @bis = DATEADD(MONTH, -1, @bis)
|
|
INSERT @tmpb
|
|
EXEC sp_rpt_fhrlst_projekte_nach_ma_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
|
|
SET @bis = DATEADD(MONTH, +1, @bis)
|
|
INSERT @tmpc
|
|
EXEC sp_rpt_fhrlst_aufwand_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
SET @bis = DATEADD(MONTH, -1, @bis)
|
|
INSERT @tmpd
|
|
EXEC sp_rpt_fhrlst_aufwand_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
|
|
DECLARE @sum1 FLOAT
|
|
DECLARE @sum2 FLOAT
|
|
|
|
DECLARE @pnr VARCHAR(255)
|
|
DECLARE @pn VARCHAR(255)
|
|
DECLARE @summe FLOAT
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpb
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu )
|
|
VALUES ( @pnr, @pn, 0, @summe, 0, 0 )
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
DECLARE @rc INT
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpa
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM @f18
|
|
WHERE projektnr = @pnr
|
|
IF @rc = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu )
|
|
VALUES ( @pnr, @pn, @summe, 0, 0, 1 )
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
UPDATE @f18
|
|
SET aktuell = @summe
|
|
WHERE projektnr = @pnr
|
|
END
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
--SELECT @sum1 = ROUND(SUM(ctb) / 8, 0)
|
|
--FROM @tmpc
|
|
--SELECT @sum2 = ROUND(SUM(ctb) / 8, 0)
|
|
--FROM @tmpd
|
|
--INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu )
|
|
--VALUES ( 0, 'AU', @sum1, @sum2, @sum1 - @sum2, 0 )
|
|
|
|
UPDATE @f18
|
|
SET ctb = 1
|
|
|
|
--SELECT @sum1 = ROUND(SUM(rtb) / 8, 0)
|
|
--FROM @tmpc
|
|
--SELECT @sum2 = ROUND(SUM(rtb) / 8, 0)
|
|
--FROM @tmpd
|
|
--INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu, ctb )
|
|
--VALUES ( 0, 'IN', @sum1, @sum2, @sum1 - @sum2, 0, 0 )
|
|
|
|
|
|
|
|
|
|
|
|
DELETE FROM @tmpa
|
|
DELETE FROM @tmpb
|
|
|
|
SET @bis = DATEADD(MONTH, +1, @bis)
|
|
|
|
INSERT @tmpa
|
|
EXEC sp_rpt_fhrlst_incidents_nach_ma_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
SET @bis = DATEADD(MONTH, -1, @bis)
|
|
INSERT @tmpb
|
|
EXEC sp_rpt_fhrlst_incidents_nach_ma_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpb
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu,ctb )
|
|
VALUES ( @pnr, @pn, 0, @summe, 0, 0,0 )
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpa
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM @f18
|
|
WHERE projektnr = @pnr
|
|
IF @rc = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu,ctb )
|
|
VALUES ( @pnr, @pn, @summe, 0, 0, 1 ,0)
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
UPDATE @f18
|
|
SET aktuell = @summe
|
|
WHERE projektnr = @pnr
|
|
END
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
UPDATE @f18
|
|
SET differenz = aktuell - vormonat
|
|
|
|
|
|
-- fuehrungsanteile
|
|
|
|
--DELETE FROM @tmpa
|
|
--DELETE FROM @tmpb
|
|
|
|
-- SET @bis = DATEADD(MONTH, +1, @bis)
|
|
--PRINT @bis
|
|
--INSERT @tmpa
|
|
-- EXEC sp_rpt_fhrlst_fuehrung_nach_ma_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
-- SET @bis = DATEADD(MONTH, -1, @bis)
|
|
-- INSERT @tmpb
|
|
-- EXEC sp_rpt_fhrlst_fuehrung_nach_ma_wpi @von, @bis, @oestruktur, @struktur_Ausschluss, @Honoris_Ausschluss
|
|
|
|
|
|
-- DECLARE xc CURSOR
|
|
-- FOR
|
|
-- SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
-- FROM @tmpb
|
|
-- GROUP BY projektnr, projektname
|
|
-- ORDER BY projektnr
|
|
-- OPEN xc
|
|
-- FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
-- WHILE @@FETCH_STATUS = 0
|
|
-- BEGIN
|
|
-- INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu,ctb )
|
|
-- VALUES ( @pnr, @pn, 0, @summe, 0, 0,2 )
|
|
-- FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
-- END
|
|
-- CLOSE xc
|
|
-- DEALLOCATE xc
|
|
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT projektnr, projektname, ROUND(SUM(akutell) / 8, 0)
|
|
FROM @tmpa
|
|
GROUP BY projektnr, projektname
|
|
ORDER BY projektnr
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM @f18
|
|
WHERE projektnr = @pnr
|
|
IF @rc = 0
|
|
BEGIN
|
|
INSERT @f18 ( projektnr, projektname, aktuell, vormonat, differenz, neu,ctb )
|
|
VALUES ( @pnr, @pn, @summe, 0, 0, 1 ,2)
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
UPDATE @f18
|
|
SET aktuell = @summe
|
|
WHERE projektnr = @pnr
|
|
END
|
|
FETCH NEXT FROM xc INTO @pnr, @pn, @summe
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
UPDATE @f18
|
|
SET differenz = aktuell - vormonat
|
|
|
|
|
|
|
|
SELECT *
|
|
FROM @f18
|
|
ORDER BY projektnr
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[mig_txp_data] Script Date: 27.01.2017 08:57:27 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[mig_txp_data]
|
|
AS
|
|
BEGIN
|
|
TRUNCATE TABLE dbo.TXP_LVer_IN_AU
|
|
|
|
|
|
INSERT INTO [dbo].[TXP_LVer_IN_AU] ( [Id], [Ticket_ID], [CreatedDateTime], [Besitzer], [Status], [Produkt], [Betreff], [Verantwortlicher],
|
|
[Klassifizierung], [RfC_Thema], [RfcBoard], [Statusdatum], [Prioritaet], [TicketLink], [User], [CreateDateTime],
|
|
[ExecutedDateTime], [CalculatedValue], [Title], [ForUserID] )
|
|
SELECT [Id], [Ticket_ID], CONVERT(DATETIME, [Expr1]), [Besitzer], [Status], [Produkt], [Betreff], [Verantwortlicher], [Klassifizierung],
|
|
[RfC_Thema], [RfcBoard], CONVERT(DATETIME, [Expr2]), [Prioritaet], [TicketLink], [User], CONVERT(DATETIME, [Createdatetime]),
|
|
CONVERT(DATETIME, [Expr3]), [CalculatedValue], [Title], [ForUserID]
|
|
FROM [dbo].[____SHU_LVER_IN_AU]
|
|
|
|
TRUNCATE TABLE dbo.TXP_Ticket_Data
|
|
|
|
INSERT INTO [dbo].[TXP_Ticket_Data] ( [Statusid], [Id], [TicketID], [Erstellungsdatum], [Status_Alt], [Status_Neu], [TGNummer], [Status_Changedate],
|
|
[Besitzergruppe], [Produkt], [Kategorie], [Stoerungstyp], [Prioritaet], [Ausfuehrung_Durch], [OwnerTG],
|
|
[OwnerName] )
|
|
SELECT [Statusid], [Id], [TicketID], CONVERT(DATETIME, [Erstellungsdatum]), [Status_Alt], [Status_Neu], [TGNummer],
|
|
CONVERT(DATETIME, [Status_Changedate]), [Besitzergruppe], [Produkt], [Kategorie], [Stoerungstyp], [Prioritaet], [Ausfuehrung_Durch],
|
|
[OwnerTG], [OwnerName]
|
|
FROM [dbo].[____SHU_Ticketdata]
|
|
|
|
|
|
TRUNCATE TABLE dbo.TXP_Ticketdata_AU
|
|
|
|
|
|
INSERT INTO [dbo].[TXP_Ticketdata_AU] ( [Ticketid], [Erstellungsdatum], [Auftragsart], [Kurzbeschreibung], [RFCBoard], [RFCThema], [Prioritaet],
|
|
[Status], [Statusdatum], [ComitRef], [Avaloq_Issue], [Einspielungstermin], [Einspielungstermin_Sortierbar],
|
|
[Besitzer], [Plankosten_ex], [Plant_PT_intern], TGNummer, [FullName] )
|
|
SELECT [TickeNr], CONVERT(DATETIME, [Expr1]) AS Erstellungsdatum, [Auftragsart], [Kurzbeschreibung], [RFCBoard], [RFCThema], [Prioritaet],
|
|
[Status], CONVERT(DATETIME, [Expr2]) AS Statusdatum, [ComitRef], [Avaloq_Issue], [Einspielungstermin], [Einspielungstermin_Sortierbar],
|
|
[Besitzer], [Plankosten_ex], [Plant_PT_intern], [Name], [FullName]
|
|
FROM [dbo].[____SHU_Ticketdata_AU]
|
|
|
|
|
|
TRUNCATE TABLE txp_ticketdata_in
|
|
INSERT INTO [dbo].[TXP_Ticketdata_IN] ( [Id], TicketID, [Erstellungsdateum], [Besitzer], [Status], [Produkt], [Betreff], [Verantwortlicher],
|
|
[Klassifizierung], [RfC_Thema], [RfcBoard], [Statusdatum], [FriendlyName], [Prioritaet], [TicketLink], TGNUmmer,
|
|
[FullName] )
|
|
SELECT [Id], [Ticket_ID], CONVERT(DATETIME, [Expr1]) AS Erstellungsdateum, [Besitzer], [Status], [Produkt], [Betreff], [Verantwortlicher],
|
|
[Klassifizierung], [RfC_Thema], [RfcBoard], CONVERT(DATETIME, [Expr2]) AS Statusdatum, [FriendlyName], [Prioritaet], [TicketLink],
|
|
[Name], [FullName]
|
|
FROM [dbo].[____SHU_TicketData_IN]
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_mitarbeiter_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'mitarbeiter' including combined Filed using Name, Vorname, TGNummer
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[my_mitarbeiter_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT *,
|
|
[Name] + ' '+ [Vorname] + ', ' + [TGNummer] as Fullname
|
|
FROM [dbo].[mitarbeiter]
|
|
where aktiv=1
|
|
ORDER BY
|
|
[mitarbeiternr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_mitarbeiter_SelectWithTGNummer] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'mitarbeiter'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[my_mitarbeiter_SelectWithTGNummer]
|
|
@stgnummer varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
SELECT *
|
|
|
|
FROM [dbo].[mitarbeiter]
|
|
WHERE
|
|
aktiv=1 and tgnummer=@stgnummer
|
|
ORDER BY
|
|
[mitarbeiternr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_security_check_entry] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[my_security_check_entry]
|
|
@form varchar(255),
|
|
@objecttype varchar(255),
|
|
@object varchar(255),
|
|
@objectitem varchar(255),
|
|
@objexists int output
|
|
AS
|
|
SELECT SecurityForm, SecurityObjectType, SecurityObject, SecurityObjectItem, Aktiv
|
|
FROM dbo.SecurityObject
|
|
WHERE SecurityForm=@form and securityobjecttype=@objecttype and securityobject=@object and securityobjectitem=@objectitem and aktiv=1
|
|
set @objexists=@@rowcount
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_security_delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[my_security_delete]
|
|
@key INT,
|
|
@mutierer int
|
|
AS
|
|
BEGIN
|
|
UPDATE dbo.SecurityObject SET aktiv=0, mutierer=@mutierer,Mutiert_am=GETDATE() WHERE securityobjectnr=@key
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_security_get_data] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[my_security_get_data]
|
|
@formname varchar(255),
|
|
@mitarbeiternr int
|
|
as
|
|
|
|
SELECT DISTINCT
|
|
dbo.SecurityObject.SecurityObjectNr, dbo.SecurityObject.SecurityForm, dbo.SecurityObject.SecurityObjectType, dbo.SecurityObject.SecurityObject,
|
|
dbo.SecurityObject.SecurityObjectItem, dbo.SecurityObject.Aktiv, dbo.Rolle_SecurityObject.readonly, dbo.Rolle_SecurityObject.invisible,
|
|
dbo.mitarbeiter_funktionsgruppe.mitarbeiternr
|
|
FROM dbo.Rolle_SecurityObject INNER JOIN
|
|
dbo.rolle ON dbo.Rolle_SecurityObject.rollenr = dbo.rolle.rollenr INNER JOIN
|
|
dbo.funktionsgruppe_rolle ON dbo.rolle.rollenr = dbo.funktionsgruppe_rolle.rollenr INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.funktionsgruppe_rolle.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.SecurityObject ON dbo.Rolle_SecurityObject.securityobjectnr = dbo.SecurityObject.SecurityObjectNr INNER JOIN
|
|
dbo.mitarbeiter_funktionsgruppe ON dbo.funktionsgruppe.funktionsgruppenr = dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr
|
|
WHERE (dbo.SecurityObject.Aktiv = 1) AND (dbo.Rolle_SecurityObject.aktiv = 1) AND (dbo.rolle.aktiv = 1) AND (dbo.funktionsgruppe_rolle.aktiv = 1) AND
|
|
(dbo.funktionsgruppe.aktiv = 1) AND (dbo.mitarbeiter_funktionsgruppe.aktiv = 1) AND (dbo.mitarbeiter_funktionsgruppe.mitarbeiternr = @mitarbeiternr) and dbo.SecurityObject.SecurityForm=@formname
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_security_get_formdata] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[my_security_get_formdata]
|
|
@formname VARCHAR(255)
|
|
AS
|
|
BEGIN
|
|
SELECT * FROM securityobject WHERE aktiv=1 AND SecurityForm=@formname
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_servicekatalog_leistungen_struktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[my_servicekatalog_leistungen_struktur]
|
|
@mitarbeiternr int,
|
|
@servicekatalognr int
|
|
AS
|
|
|
|
CREATE TABLE #tmpd(
|
|
[servicekatalognr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] ,
|
|
[securitylevelnr] [int],
|
|
) ON [DEFAULT]
|
|
|
|
declare @tmp int
|
|
declare xc cursor for
|
|
select servicekatalognr from servicekatalog where servicekatalognr=@servicekatalognr and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
open xc
|
|
fetch next from xc into @tmp
|
|
while @@fetch_status=0 begin
|
|
execute dbo.my_servicekatalog_struktur_down @tmp,1
|
|
fetch next from xc into @tmp
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
--insert #tmpd (servicekatalognr, bezeichnung, parentid,securitylevelnr) values(0,'Service-Katalog',null,0)
|
|
--delete from #tmpd where securitylevelnr <
|
|
|
|
select * from #tmpd order by bezeichnung
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_servicekatalog_sla_struktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[my_servicekatalog_sla_struktur]
|
|
@mitarbeiternr int
|
|
AS
|
|
SELECT dbo.SLAKatalog.SLAKatalogNr, dbo.SLATyp.Bezeichnung, dbo.SLASubTyp.Bezeichnung + ' / ' + CONVERT(varchar(10), dbo.SLAKatalog.Zeit)
|
|
+ ' / ' + dbo.Zeiteinheittyp.Bezeichnung AS SLA
|
|
FROM dbo.SLA INNER JOIN
|
|
dbo.SLASubTyp ON dbo.SLA.SLASubTypNr = dbo.SLASubTyp.SLASubTypNr INNER JOIN
|
|
dbo.SLATyp ON dbo.SLA.SLATypNr = dbo.SLATyp.SLATypNr INNER JOIN
|
|
dbo.SLAKatalog ON dbo.SLA.SLANr = dbo.SLAKatalog.SLANr INNER JOIN
|
|
dbo.Zeiteinheittyp ON dbo.SLAKatalog.Zeiteinheittypnr = dbo.Zeiteinheittyp.Zeiteinheittypnr
|
|
WHERE (dbo.SLAKatalog.Aktiv = 1) AND (dbo.SLATyp.Aktiv = 1) and dbo.slakatalog.securitylevel <=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
ORDER BY dbo.SLATyp.Bezeichnung, SLA
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_servicekatalog_struktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[my_servicekatalog_struktur]
|
|
@mitarbeiternr int,
|
|
@checkstate int
|
|
AS
|
|
|
|
CREATE TABLE #tmpd(
|
|
[servicekatalognr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] ,
|
|
[securitylevelnr] [int],
|
|
[aktiv] bit
|
|
) ON [DEFAULT]
|
|
|
|
declare @tmp int
|
|
|
|
declare xc cursor for
|
|
select servicekatalognr from servicekatalog
|
|
where parentid=0 and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
open xc
|
|
fetch next from xc into @tmp
|
|
while @@fetch_status=0 begin
|
|
execute dbo.my_servicekatalog_struktur_down @tmp,1
|
|
fetch next from xc into @tmp
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
insert #tmpd (servicekatalognr, bezeichnung, parentid,securitylevelnr,aktiv) values(0,'Service-Katalog',null,0,1)
|
|
--delete from #tmpd where securitylevelnr <
|
|
|
|
-------------------------------------------------------------------
|
|
-- Nur gem. Checkstate gewählte Einträge zurück geben
|
|
-- 0 = nur inaktive Einträge
|
|
-- 1 = nur aktive Einträge
|
|
-- 3 = alle Einträge -> keine Einschränkung in der Resultattabelle
|
|
-------------------------------------------------------------------
|
|
if @checkstate = 0 begin-- inaktiv
|
|
delete from #tmpd where (aktiv=1 and servicekatalognr > 0 and servicekatalognr not in (select parentid from #tmpd where aktiv=0))
|
|
-- select * from #tmpd
|
|
select * into #tmpe from #tmpd
|
|
declare yc cursor for
|
|
select parentid from #tmpe
|
|
open yc
|
|
fetch next from yc into @tmp
|
|
while @@fetch_status=0 begin
|
|
print @tmp
|
|
execute dbo.my_servicekatalog_struktur_up @tmp,1
|
|
fetch next from yc into @tmp
|
|
end
|
|
close yc
|
|
deallocate yc
|
|
delete from #tmpd where servicekatalognr is null
|
|
drop table #tmpe
|
|
end
|
|
if @checkstate = 1 begin -- aktiv
|
|
delete from #tmpd where aktiv=0 and servicekatalognr > 0
|
|
end
|
|
|
|
select distinct * from #tmpd
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_servicekatalog_struktur_down] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[my_servicekatalog_struktur_down]
|
|
@Root int,
|
|
@imandant int
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON
|
|
|
|
declare @katalogid int, @bezeichnung varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit
|
|
|
|
select @bezeichnung=bezeichnung_intern, @nr=servicekatalognr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv from servicekatalog
|
|
where servicekatalognr=@root and mandantnr=@imandant
|
|
insert into #tmpd (servicekatalognr, bezeichnung, parentid,securitylevelnr, aktiv) values (@nr, @bezeichnung, @parent,@seclevel,@aktiv)
|
|
set @katalogid=(select min (servicekatalognr) from servicekatalog where parentid=@root)
|
|
while @katalogid is not null begin
|
|
exec dbo.my_servicekatalog_struktur_down @katalogid, 1
|
|
set @katalogid=(select min (servicekatalognr) from dbo.servicekatalog
|
|
where parentid=@root and servicekatalognr > @katalogid )
|
|
end
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_servicekatalog_struktur_up] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[my_servicekatalog_struktur_up]
|
|
@Root int,
|
|
@imandant int
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON
|
|
|
|
declare @katalogid int, @bezeichnung varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit
|
|
|
|
select @bezeichnung=bezeichnung_intern, @nr=servicekatalognr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv from servicekatalog
|
|
where servicekatalognr=@root and mandantnr=@imandant
|
|
print @bezeichnung
|
|
insert into #tmpd (servicekatalognr, bezeichnung, parentid,securitylevelnr, aktiv) values (@nr, @bezeichnung, @parent,@seclevel,@aktiv)
|
|
print @parent
|
|
print '---'
|
|
|
|
|
|
set @katalogid=(select parentid from servicekatalog where servicekatalognr=@nr)
|
|
|
|
while @katalogid is not null begin
|
|
exec dbo.my_servicekatalog_struktur_up @katalogid, 1
|
|
set @katalogid=(select parentid from dbo.servicekatalog
|
|
where servicekatalognr = @nr and parentid>@katalogid)
|
|
end
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_tooltip_get_data] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[my_tooltip_get_data]
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
select * from tooltip where aktiv=1
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[my_vertragselement_parentelemente_old] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[my_vertragselement_parentelemente_old] @vertragspartnernr int,
|
|
@mitarbeiternr int
|
|
|
|
AS
|
|
|
|
--select *, vertragselementnr, bezeichnung from vertragselement where vertragspartnernr=@vertragspartnernr order by bezeichnung
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Aktivitaet_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Aktivitaet'
|
|
-- using the Primary Key.
|
|
-- Gets: @iAktivitaetNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Aktivitaet_Delete]
|
|
@iAktivitaetNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Aktivitaet]
|
|
WHERE
|
|
[AktivitaetNr] = @iAktivitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Aktivitaet_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Aktivitaet'
|
|
-- Gets: @iEreignisnr int
|
|
-- Gets: @iAktivitaetStatusNr int
|
|
-- Gets: @iPeriodizitaetnr int
|
|
-- Gets: @daAusgeloest_am datetime
|
|
-- Gets: @sEreignis varchar(50)
|
|
-- Gets: @sKostenart varchar(50)
|
|
-- Gets: @fBetrag float(53)
|
|
-- Gets: @sTermin varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @iSecuritylevelnr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sKuendigungsfrist varchar(255)
|
|
-- Gets: @iVertragselementnr int
|
|
-- Returns: @iAktivitaetNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Aktivitaet_Insert]
|
|
@iEreignisnr int,
|
|
@iAktivitaetStatusNr int,
|
|
@iPeriodizitaetnr int,
|
|
@daAusgeloest_am datetime,
|
|
@sEreignis varchar(50),
|
|
@sKostenart varchar(50),
|
|
@fBetrag float(53),
|
|
@sTermin varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@sBemerkung varchar(255),
|
|
@iSecuritylevelnr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sKuendigungsfrist varchar(255),
|
|
@iVertragselementnr int,
|
|
@iAktivitaetNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Aktivitaet]
|
|
(
|
|
[Ereignisnr],
|
|
[AktivitaetStatusNr],
|
|
[Periodizitaetnr],
|
|
[Ausgeloest_am],
|
|
[Ereignis],
|
|
[Kostenart],
|
|
[Betrag],
|
|
[Termin],
|
|
[Beschreibung],
|
|
[Bemerkung],
|
|
[Securitylevelnr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Kuendigungsfrist],
|
|
[Vertragselementnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iEreignisnr,
|
|
@iAktivitaetStatusNr,
|
|
@iPeriodizitaetnr,
|
|
@daAusgeloest_am,
|
|
@sEreignis,
|
|
@sKostenart,
|
|
@fBetrag,
|
|
@sTermin,
|
|
@sBeschreibung,
|
|
@sBemerkung,
|
|
@iSecuritylevelnr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@sKuendigungsfrist,
|
|
@iVertragselementnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iAktivitaetNr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Aktivitaet_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Aktivitaet'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Aktivitaet_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[AktivitaetNr],
|
|
[Ereignisnr],
|
|
[AktivitaetStatusNr],
|
|
[Periodizitaetnr],
|
|
[Ausgeloest_am],
|
|
[Ereignis],
|
|
[Kostenart],
|
|
[Betrag],
|
|
[Termin],
|
|
[Beschreibung],
|
|
[Bemerkung],
|
|
[Securitylevelnr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Kuendigungsfrist],
|
|
[Vertragselementnr]
|
|
FROM [dbo].[Aktivitaet]
|
|
ORDER BY
|
|
[AktivitaetNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Aktivitaet_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Aktivitaet'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Aktivitaet_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
SELECT dbo.Aktivitaet.AktivitaetNr, dbo.Aktivitaet.Ereignisnr, dbo.Aktivitaet.AktivitaetStatusNr, dbo.AktivitaetStatus.Bezeichnung, dbo.Aktivitaet.Periodizitaetnr,
|
|
dbo.Periodizitaet.Bezeichnung AS Periodizitaet, dbo.Vertragselement.Vertragselementnr, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Aktivitaet.Ausgeloest_am, dbo.Aktivitaet.Ereignis, dbo.Aktivitaet.Kostenart, dbo.Aktivitaet.Betrag, dbo.Aktivitaet.Termin, dbo.Aktivitaet.Beschreibung,
|
|
dbo.Aktivitaet.Bemerkung, dbo.Aktivitaet.Securitylevelnr, dbo.Aktivitaet.Aktiv, dbo.Aktivitaet.Erstellt_am, dbo.Aktivitaet.Mutiert_am, dbo.Aktivitaet.Mutierer
|
|
FROM dbo.Aktivitaet INNER JOIN
|
|
dbo.AktivitaetStatus ON dbo.Aktivitaet.AktivitaetStatusNr = dbo.AktivitaetStatus.AktivitaetStatusNr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Aktivitaet.Periodizitaetnr = dbo.Periodizitaet.PeriodizitaetNr INNER JOIN
|
|
dbo.Vertragsereignis ON dbo.Aktivitaet.Ereignisnr = dbo.Vertragsereignis.EreignisNr INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragsereignis.Vertragselementnr = dbo.Vertragselement.Vertragselementnr
|
|
where dbo.aktivitaet.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and dbo.vertragselement.vertragselementnr = @keyvalue
|
|
ORDER BY
|
|
[AktivitaetNr] Desc
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Aktivitaet_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Aktivitaet'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iAktivitaetNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Aktivitaet_SelectOne]
|
|
@iAktivitaetNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[AktivitaetNr],
|
|
[Ereignisnr],
|
|
[AktivitaetStatusNr],
|
|
[Periodizitaetnr],
|
|
[Ausgeloest_am],
|
|
[Ereignis],
|
|
[Kostenart],
|
|
[Betrag],
|
|
[Termin],
|
|
[Beschreibung],
|
|
[Bemerkung],
|
|
[Securitylevelnr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Kuendigungsfrist],
|
|
[Vertragselementnr]
|
|
FROM [dbo].[Aktivitaet]
|
|
WHERE
|
|
[AktivitaetNr] = @iAktivitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Aktivitaet_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Aktivitaet'
|
|
-- Gets: @iAktivitaetNr int
|
|
-- Gets: @iEreignisnr int
|
|
-- Gets: @iAktivitaetStatusNr int
|
|
-- Gets: @iPeriodizitaetnr int
|
|
-- Gets: @daAusgeloest_am datetime
|
|
-- Gets: @sEreignis varchar(50)
|
|
-- Gets: @sKostenart varchar(50)
|
|
-- Gets: @fBetrag float(53)
|
|
-- Gets: @sTermin varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @iSecuritylevelnr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sKuendigungsfrist varchar(255)
|
|
-- Gets: @iVertragselementnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Aktivitaet_Update]
|
|
@iAktivitaetNr int,
|
|
@iEreignisnr int,
|
|
@iAktivitaetStatusNr int,
|
|
@iPeriodizitaetnr int,
|
|
@daAusgeloest_am datetime,
|
|
@sEreignis varchar(50),
|
|
@sKostenart varchar(50),
|
|
@fBetrag float(53),
|
|
@sTermin varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@sBemerkung varchar(255),
|
|
@iSecuritylevelnr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sKuendigungsfrist varchar(255),
|
|
@iVertragselementnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Aktivitaet]
|
|
SET
|
|
[Ereignisnr] = @iEreignisnr,
|
|
[AktivitaetStatusNr] = @iAktivitaetStatusNr,
|
|
[Periodizitaetnr] = @iPeriodizitaetnr,
|
|
[Ausgeloest_am] = @daAusgeloest_am,
|
|
[Ereignis] = @sEreignis,
|
|
[Kostenart] = @sKostenart,
|
|
[Betrag] = @fBetrag,
|
|
[Termin] = @sTermin,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Securitylevelnr] = @iSecuritylevelnr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Kuendigungsfrist] = @sKuendigungsfrist,
|
|
[Vertragselementnr] = @iVertragselementnr
|
|
WHERE
|
|
[AktivitaetNr] = @iAktivitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AktivitaetStatus_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
-- Stored procedure that will delete an existing row from the table 'AktivitaetStatus'
|
|
|
|
-- using the Primary Key.
|
|
|
|
-- Gets: @iAktivitaetStatusNr int
|
|
|
|
-- Returns: @iErrorCode int
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].[pr_AktivitaetStatus_Delete]
|
|
|
|
@iAktivitaetStatusNr int,
|
|
|
|
@iErrorCode int OUTPUT
|
|
|
|
AS
|
|
|
|
SET NOCOUNT ON
|
|
|
|
-- DELETE an existing row from the table.
|
|
|
|
DELETE FROM [dbo].[AktivitaetStatus]
|
|
|
|
WHERE
|
|
|
|
[AktivitaetStatusNr] = @iAktivitaetStatusNr
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AktivitaetStatus_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
-- Stored procedure that will insert 1 row in the table 'AktivitaetStatus'
|
|
|
|
-- Gets: @iAktivitaetStatusNr int
|
|
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
|
|
-- Gets: @bAktiv bit
|
|
|
|
-- Gets: @daErstellt_am datetime
|
|
|
|
-- Gets: @daMutiert_am datetime
|
|
|
|
-- Gets: @iMutierer int
|
|
|
|
-- Gets: @bAktivitaet_Aktivieren bit
|
|
|
|
-- Gets: @bAktivitaet_Inaktivieren bit
|
|
|
|
-- Returns: @iErrorCode int
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].[pr_AktivitaetStatus_Insert]
|
|
|
|
@iAktivitaetStatusNr int,
|
|
|
|
@sBezeichnung varchar(50),
|
|
|
|
@sBeschreibung varchar(50),
|
|
|
|
@bAktiv bit,
|
|
|
|
@daErstellt_am datetime,
|
|
|
|
@daMutiert_am datetime,
|
|
|
|
@iMutierer int,
|
|
|
|
@bAktivitaet_Aktivieren bit,
|
|
|
|
@bAktivitaet_Inaktivieren bit,
|
|
|
|
@iErrorCode int OUTPUT
|
|
|
|
AS
|
|
|
|
SET NOCOUNT ON
|
|
|
|
-- INSERT a new row in the table.
|
|
|
|
INSERT [dbo].[AktivitaetStatus]
|
|
|
|
(
|
|
|
|
[AktivitaetStatusNr],
|
|
|
|
[Bezeichnung],
|
|
|
|
[Beschreibung],
|
|
|
|
[Aktiv],
|
|
|
|
[Erstellt_am],
|
|
|
|
[Mutiert_am],
|
|
|
|
[Mutierer],
|
|
|
|
[Aktivitaet_Aktivieren],
|
|
|
|
[Aktivitaet_Inaktivieren]
|
|
|
|
)
|
|
|
|
VALUES
|
|
|
|
(
|
|
|
|
@iAktivitaetStatusNr,
|
|
|
|
@sBezeichnung,
|
|
|
|
@sBeschreibung,
|
|
|
|
@bAktiv,
|
|
|
|
@daErstellt_am,
|
|
|
|
@daMutiert_am,
|
|
|
|
@iMutierer,
|
|
|
|
@bAktivitaet_Aktivieren,
|
|
|
|
@bAktivitaet_Inaktivieren
|
|
|
|
)
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AktivitaetStatus_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
-- Stored procedure that will select all rows from the table 'AktivitaetStatus'
|
|
|
|
-- Returns: @iErrorCode int
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].[pr_AktivitaetStatus_SelectAll]
|
|
|
|
@iErrorCode int OUTPUT
|
|
|
|
AS
|
|
|
|
SET NOCOUNT ON
|
|
|
|
-- SELECT all rows from the table.
|
|
|
|
SELECT
|
|
|
|
[AktivitaetStatusNr],
|
|
|
|
[Bezeichnung],
|
|
|
|
[Beschreibung],
|
|
|
|
[Aktiv],
|
|
|
|
[Erstellt_am],
|
|
|
|
[Mutiert_am],
|
|
|
|
[Mutierer],
|
|
|
|
[Aktivitaet_Aktivieren],
|
|
|
|
[Aktivitaet_Inaktivieren]
|
|
|
|
FROM [dbo].[AktivitaetStatus]
|
|
|
|
ORDER BY
|
|
|
|
[AktivitaetStatusNr] ASC
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AktivitaetStatus_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
-- Stored procedure that will select an existing row from the table 'AktivitaetStatus'
|
|
|
|
-- based on the Primary Key.
|
|
|
|
-- Gets: @iAktivitaetStatusNr int
|
|
|
|
-- Returns: @iErrorCode int
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].[pr_AktivitaetStatus_SelectOne]
|
|
|
|
@iAktivitaetStatusNr int,
|
|
|
|
@iErrorCode int OUTPUT
|
|
|
|
AS
|
|
|
|
SET NOCOUNT ON
|
|
|
|
-- SELECT an existing row from the table.
|
|
|
|
SELECT
|
|
|
|
[AktivitaetStatusNr],
|
|
|
|
[Bezeichnung],
|
|
|
|
[Beschreibung],
|
|
|
|
[Aktiv],
|
|
|
|
[Erstellt_am],
|
|
|
|
[Mutiert_am],
|
|
|
|
[Mutierer],
|
|
|
|
[Aktivitaet_Aktivieren],
|
|
|
|
[Aktivitaet_Inaktivieren]
|
|
|
|
FROM [dbo].[AktivitaetStatus]
|
|
|
|
WHERE
|
|
|
|
[AktivitaetStatusNr] = @iAktivitaetStatusNr
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AktivitaetStatus_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
-- Stored procedure that will update an existing row in the table 'AktivitaetStatus'
|
|
|
|
-- Gets: @iAktivitaetStatusNr int
|
|
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
|
|
-- Gets: @bAktiv bit
|
|
|
|
-- Gets: @daErstellt_am datetime
|
|
|
|
-- Gets: @daMutiert_am datetime
|
|
|
|
-- Gets: @iMutierer int
|
|
|
|
-- Gets: @bAktivitaet_Aktivieren bit
|
|
|
|
-- Gets: @bAktivitaet_Inaktivieren bit
|
|
|
|
-- Returns: @iErrorCode int
|
|
|
|
---------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].[pr_AktivitaetStatus_Update]
|
|
|
|
@iAktivitaetStatusNr int,
|
|
|
|
@sBezeichnung varchar(50),
|
|
|
|
@sBeschreibung varchar(50),
|
|
|
|
@bAktiv bit,
|
|
|
|
@daErstellt_am datetime,
|
|
|
|
@daMutiert_am datetime,
|
|
|
|
@iMutierer int,
|
|
|
|
@bAktivitaet_Aktivieren bit,
|
|
|
|
@bAktivitaet_Inaktivieren bit,
|
|
|
|
@iErrorCode int OUTPUT
|
|
|
|
AS
|
|
|
|
SET NOCOUNT ON
|
|
|
|
-- UPDATE an existing row in the table.
|
|
|
|
UPDATE [dbo].[AktivitaetStatus]
|
|
|
|
SET
|
|
|
|
[Bezeichnung] = @sBezeichnung,
|
|
|
|
[Beschreibung] = @sBeschreibung,
|
|
|
|
[Aktiv] = @bAktiv,
|
|
|
|
[Erstellt_am] = @daErstellt_am,
|
|
|
|
[Mutiert_am] = @daMutiert_am,
|
|
|
|
[Mutierer] = @iMutierer,
|
|
|
|
[Aktivitaet_Aktivieren] = @bAktivitaet_Aktivieren,
|
|
|
|
[Aktivitaet_Inaktivieren] = @bAktivitaet_Inaktivieren
|
|
|
|
WHERE
|
|
|
|
[AktivitaetStatusNr] = @iAktivitaetStatusNr
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Application_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Application'
|
|
-- using the Primary Key.
|
|
-- Gets: @iapplikationsnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Application_Delete]
|
|
@iapplikationsnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Application]
|
|
WHERE
|
|
[applikationsnr] = @iapplikationsnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Application_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Application'
|
|
-- Gets: @iapplikationsnr int
|
|
-- Gets: @sversion varchar(4)
|
|
-- Gets: @bshowlogin bit
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @stmp_filepath varchar(255)
|
|
-- Gets: @bVertragsuebersicht_aktualisieren bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Application_Insert]
|
|
@iapplikationsnr int,
|
|
@sversion varchar(4),
|
|
@bshowlogin bit,
|
|
@imandantnr int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@stmp_filepath varchar(255),
|
|
@bVertragsuebersicht_aktualisieren bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Application]
|
|
(
|
|
[applikationsnr],
|
|
[version],
|
|
[showlogin],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[tmp_filepath],
|
|
[Vertragsuebersicht_aktualisieren]
|
|
)
|
|
VALUES
|
|
(
|
|
@iapplikationsnr,
|
|
@sversion,
|
|
@bshowlogin,
|
|
@imandantnr,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@stmp_filepath,
|
|
@bVertragsuebersicht_aktualisieren
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Application_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Application'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Application_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[applikationsnr],
|
|
[version],
|
|
[showlogin],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[tmp_filepath],
|
|
[Vertragsuebersicht_aktualisieren]
|
|
FROM [dbo].[Application]
|
|
ORDER BY
|
|
[applikationsnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Application_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Application'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iapplikationsnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Application_SelectOne]
|
|
@iapplikationsnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[applikationsnr],
|
|
[version],
|
|
[showlogin],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[tmp_filepath],
|
|
[Vertragsuebersicht_aktualisieren]
|
|
FROM [dbo].[Application]
|
|
WHERE
|
|
[applikationsnr] = @iapplikationsnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Application_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Application'
|
|
-- Gets: @iapplikationsnr int
|
|
-- Gets: @sversion varchar(4)
|
|
-- Gets: @bshowlogin bit
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @stmp_filepath varchar(255)
|
|
-- Gets: @bVertragsuebersicht_aktualisieren bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Application_Update]
|
|
@iapplikationsnr int,
|
|
@sversion varchar(4),
|
|
@bshowlogin bit,
|
|
@imandantnr int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@stmp_filepath varchar(255),
|
|
@bVertragsuebersicht_aktualisieren bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Application]
|
|
SET
|
|
[version] = @sversion,
|
|
[showlogin] = @bshowlogin,
|
|
[mandantnr] = @imandantnr,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[tmp_filepath] = @stmp_filepath,
|
|
[Vertragsuebersicht_aktualisieren] = @bVertragsuebersicht_aktualisieren
|
|
WHERE
|
|
[applikationsnr] = @iapplikationsnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikation'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_Delete]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikation]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Ausfalldauer_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikation_IKV_Ausfalldauer'
|
|
-- using the Primary Key.
|
|
-- Gets: @iIKVAusfalldauernr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Ausfalldauer_Delete]
|
|
@iIKVAusfalldauernr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikation_IKV_Ausfalldauer]
|
|
WHERE
|
|
[IKVAusfalldauernr] = @iIKVAusfalldauernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Ausfalldauer_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikation_IKV_Ausfalldauer'
|
|
-- Gets: @iIKVAusfalldauernr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iReihenfolge int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Ausfalldauer_Insert]
|
|
@iIKVAusfalldauernr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iReihenfolge int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Applikation_IKV_Ausfalldauer]
|
|
(
|
|
[IKVAusfalldauernr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
)
|
|
VALUES
|
|
(
|
|
@iIKVAusfalldauernr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iReihenfolge
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Ausfalldauer_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikation_IKV_Ausfalldauer'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Ausfalldauer_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[IKVAusfalldauernr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
FROM [dbo].[Applikation_IKV_Ausfalldauer]
|
|
ORDER BY
|
|
[IKVAusfalldauernr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Ausfalldauer_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikation_IKV_Ausfalldauer'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iIKVAusfalldauernr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Ausfalldauer_SelectOne]
|
|
@iIKVAusfalldauernr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[IKVAusfalldauernr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
FROM [dbo].[Applikation_IKV_Ausfalldauer]
|
|
WHERE
|
|
[IKVAusfalldauernr] = @iIKVAusfalldauernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Ausfalldauer_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikation_IKV_Ausfalldauer'
|
|
-- Gets: @iIKVAusfalldauernr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iReihenfolge int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Ausfalldauer_Update]
|
|
@iIKVAusfalldauernr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iReihenfolge int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Applikation_IKV_Ausfalldauer]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Reihenfolge] = @iReihenfolge
|
|
WHERE
|
|
[IKVAusfalldauernr] = @iIKVAusfalldauernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_LoesungTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikation_IKV_LoesungTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iIKVLoesungTypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_LoesungTyp_Delete]
|
|
@iIKVLoesungTypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikation_IKV_LoesungTyp]
|
|
WHERE
|
|
[IKVLoesungTypnr] = @iIKVLoesungTypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_LoesungTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikation_IKV_LoesungTyp'
|
|
-- Gets: @iIKVLoesungTypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_LoesungTyp_Insert]
|
|
@iIKVLoesungTypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Applikation_IKV_LoesungTyp]
|
|
(
|
|
[IKVLoesungTypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iIKVLoesungTypnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_LoesungTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikation_IKV_LoesungTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_LoesungTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[IKVLoesungTypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Applikation_IKV_LoesungTyp]
|
|
ORDER BY
|
|
[IKVLoesungTypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_LoesungTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikation_IKV_LoesungTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iIKVLoesungTypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_LoesungTyp_SelectOne]
|
|
@iIKVLoesungTypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[IKVLoesungTypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Applikation_IKV_LoesungTyp]
|
|
WHERE
|
|
[IKVLoesungTypnr] = @iIKVLoesungTypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_LoesungTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikation_IKV_LoesungTyp'
|
|
-- Gets: @iIKVLoesungTypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_LoesungTyp_Update]
|
|
@iIKVLoesungTypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Applikation_IKV_LoesungTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[IKVLoesungTypnr] = @iIKVLoesungTypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Relevanztyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikation_IKV_Relevanztyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iIKVRelevanztypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Relevanztyp_Delete]
|
|
@iIKVRelevanztypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikation_IKV_Relevanztyp]
|
|
WHERE
|
|
[IKVRelevanztypnr] = @iIKVRelevanztypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Relevanztyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikation_IKV_Relevanztyp'
|
|
-- Gets: @iIKVRelevanztypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Relevanztyp_Insert]
|
|
@iIKVRelevanztypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Applikation_IKV_Relevanztyp]
|
|
(
|
|
[IKVRelevanztypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iIKVRelevanztypnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Relevanztyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikation_IKV_Relevanztyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Relevanztyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[IKVRelevanztypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Applikation_IKV_Relevanztyp]
|
|
ORDER BY
|
|
[IKVRelevanztypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Relevanztyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikation_IKV_Relevanztyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iIKVRelevanztypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Relevanztyp_SelectOne]
|
|
@iIKVRelevanztypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[IKVRelevanztypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Applikation_IKV_Relevanztyp]
|
|
WHERE
|
|
[IKVRelevanztypnr] = @iIKVRelevanztypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Relevanztyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikation_IKV_Relevanztyp'
|
|
-- Gets: @iIKVRelevanztypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Relevanztyp_Update]
|
|
@iIKVRelevanztypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Applikation_IKV_Relevanztyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[IKVRelevanztypnr] = @iIKVRelevanztypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Test_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikation_IKV_Test'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikation_IKV_TestNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Test_Delete]
|
|
@iApplikation_IKV_TestNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikation_IKV_Test]
|
|
WHERE
|
|
[Applikation_IKV_TestNr] = @iApplikation_IKV_TestNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Test_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikation_IKV_Test'
|
|
-- Gets: @iApplikation_IKV_TestNr int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iJahr int
|
|
-- Gets: @daGeplant datetime
|
|
-- Gets: @daDurchgeführt datetime
|
|
-- Gets: @iApplikation_IKV_TestResultatNr int
|
|
-- Gets: @sBemerkung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Test_Insert]
|
|
@iApplikation_IKV_TestNr int,
|
|
@iApplikationNr int,
|
|
@iJahr int,
|
|
@daGeplant datetime,
|
|
@daDurchgeführt datetime,
|
|
@iApplikation_IKV_TestResultatNr int,
|
|
@sBemerkung 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].[Applikation_IKV_Test]
|
|
(
|
|
[Applikation_IKV_TestNr],
|
|
[ApplikationNr],
|
|
[Jahr],
|
|
[Geplant],
|
|
[Durchgeführt],
|
|
[Applikation_IKV_TestResultatNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikation_IKV_TestNr,
|
|
@iApplikationNr,
|
|
@iJahr,
|
|
@daGeplant,
|
|
@daDurchgeführt,
|
|
@iApplikation_IKV_TestResultatNr,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Test_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikation_IKV_Test'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Test_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Applikation_IKV_TestNr],
|
|
[ApplikationNr],
|
|
[Jahr],
|
|
[Geplant],
|
|
[Durchgeführt],
|
|
[Applikation_IKV_TestResultatNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Applikation_IKV_Test]
|
|
ORDER BY
|
|
[Applikation_IKV_TestNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Test_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
Create proc [dbo].[pr_Applikation_IKV_Test_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationkontakt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
|
|
|
|
SELECT dbo.Applikation_IKV_Test.Applikation_IKV_TestNr, dbo.Applikation_IKV_Test.ApplikationNr, dbo.Applikation_IKV_Test.Jahr, dbo.Applikation_IKV_Test.Geplant,
|
|
dbo.Applikation_IKV_Test.Durchgeführt, dbo.Applikation_IKV_Test.Applikation_IKV_TestResultatNr, dbo.Applikation_IKV_Test.Bemerkung,
|
|
dbo.Applikation_IKV_Test.Aktiv, dbo.Applikation_IKV_Test.Erstellt_am, dbo.Applikation_IKV_Test.Mutiert_am, dbo.Applikation_IKV_Test.Mutierer,
|
|
dbo.Applikation_IKV_TestResultat.Bezeichnung AS Resultat
|
|
FROM dbo.Applikation_IKV_Test INNER JOIN
|
|
dbo.Applikation_IKV_TestResultat ON dbo.Applikation_IKV_Test.Applikation_IKV_TestResultatNr = dbo.Applikation_IKV_TestResultat.IKVTestResultatnr
|
|
WHERE dbo.Applikation_IKV_Test.ApplikationNr = @keyvalue
|
|
ORDER BY
|
|
[Jahr] desc
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Test_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikation_IKV_Test'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikation_IKV_TestNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Test_SelectOne]
|
|
@iApplikation_IKV_TestNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Applikation_IKV_TestNr],
|
|
[ApplikationNr],
|
|
[Jahr],
|
|
[Geplant],
|
|
[Durchgeführt],
|
|
[Applikation_IKV_TestResultatNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Applikation_IKV_Test]
|
|
WHERE
|
|
[Applikation_IKV_TestNr] = @iApplikation_IKV_TestNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_Test_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikation_IKV_Test'
|
|
-- Gets: @iApplikation_IKV_TestNr int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iJahr int
|
|
-- Gets: @daGeplant datetime
|
|
-- Gets: @daDurchgeführt datetime
|
|
-- Gets: @iApplikation_IKV_TestResultatNr int
|
|
-- Gets: @sBemerkung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_Test_Update]
|
|
@iApplikation_IKV_TestNr int,
|
|
@iApplikationNr int,
|
|
@iJahr int,
|
|
@daGeplant datetime,
|
|
@daDurchgeführt datetime,
|
|
@iApplikation_IKV_TestResultatNr int,
|
|
@sBemerkung 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].[Applikation_IKV_Test]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr,
|
|
[Jahr] = @iJahr,
|
|
[Geplant] = @daGeplant,
|
|
[Durchgeführt] = @daDurchgeführt,
|
|
[Applikation_IKV_TestResultatNr] = @iApplikation_IKV_TestResultatNr,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Applikation_IKV_TestNr] = @iApplikation_IKV_TestNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_TestResultat_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikation_IKV_TestResultat'
|
|
-- using the Primary Key.
|
|
-- Gets: @iIKVTestResultatnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_TestResultat_Delete]
|
|
@iIKVTestResultatnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikation_IKV_TestResultat]
|
|
WHERE
|
|
[IKVTestResultatnr] = @iIKVTestResultatnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_TestResultat_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikation_IKV_TestResultat'
|
|
-- Gets: @iIKVTestResultatnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iReihenfolge int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_TestResultat_Insert]
|
|
@iIKVTestResultatnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iReihenfolge int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Applikation_IKV_TestResultat]
|
|
(
|
|
[IKVTestResultatnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
)
|
|
VALUES
|
|
(
|
|
@iIKVTestResultatnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iReihenfolge
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_TestResultat_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikation_IKV_TestResultat'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_TestResultat_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[IKVTestResultatnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
FROM [dbo].[Applikation_IKV_TestResultat]
|
|
ORDER BY
|
|
[IKVTestResultatnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_TestResultat_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikation_IKV_TestResultat'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iIKVTestResultatnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_TestResultat_SelectOne]
|
|
@iIKVTestResultatnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[IKVTestResultatnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
FROM [dbo].[Applikation_IKV_TestResultat]
|
|
WHERE
|
|
[IKVTestResultatnr] = @iIKVTestResultatnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_TestResultat_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikation_IKV_TestResultat'
|
|
-- Gets: @iIKVTestResultatnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iReihenfolge int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_TestResultat_Update]
|
|
@iIKVTestResultatnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iReihenfolge int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Applikation_IKV_TestResultat]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Reihenfolge] = @iReihenfolge
|
|
WHERE
|
|
[IKVTestResultatnr] = @iIKVTestResultatnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikation_IKV_VereinbarteAusfalldauer'
|
|
-- using the Primary Key.
|
|
-- Gets: @iIKVVereinbarteAusfalldauernr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_Delete]
|
|
@iIKVVereinbarteAusfalldauernr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikation_IKV_VereinbarteAusfalldauer]
|
|
WHERE
|
|
[IKVVereinbarteAusfalldauernr] = @iIKVVereinbarteAusfalldauernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikation_IKV_VereinbarteAusfalldauer'
|
|
-- Gets: @iIKVVereinbarteAusfalldauernr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iReihenfolge int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_Insert]
|
|
@iIKVVereinbarteAusfalldauernr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iReihenfolge int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Applikation_IKV_VereinbarteAusfalldauer]
|
|
(
|
|
[IKVVereinbarteAusfalldauernr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
)
|
|
VALUES
|
|
(
|
|
@iIKVVereinbarteAusfalldauernr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iReihenfolge
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikation_IKV_VereinbarteAusfalldauer'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[IKVVereinbarteAusfalldauernr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
FROM [dbo].[Applikation_IKV_VereinbarteAusfalldauer]
|
|
ORDER BY
|
|
[IKVVereinbarteAusfalldauernr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikation_IKV_VereinbarteAusfalldauer'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iIKVVereinbarteAusfalldauernr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_SelectOne]
|
|
@iIKVVereinbarteAusfalldauernr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[IKVVereinbarteAusfalldauernr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Reihenfolge]
|
|
FROM [dbo].[Applikation_IKV_VereinbarteAusfalldauer]
|
|
WHERE
|
|
[IKVVereinbarteAusfalldauernr] = @iIKVVereinbarteAusfalldauernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikation_IKV_VereinbarteAusfalldauer'
|
|
-- Gets: @iIKVVereinbarteAusfalldauernr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iReihenfolge int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_IKV_VereinbarteAusfalldauer_Update]
|
|
@iIKVVereinbarteAusfalldauernr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iReihenfolge int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Applikation_IKV_VereinbarteAusfalldauer]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Reihenfolge] = @iReihenfolge
|
|
WHERE
|
|
[IKVVereinbarteAusfalldauernr] = @iIKVVereinbarteAusfalldauernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikation'
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @iParentID int
|
|
-- Gets: @iApplikationVerantwortungNr int
|
|
-- Gets: @iApplikationKategorieNr int
|
|
-- Gets: @iApplikationTeamnr int
|
|
-- Gets: @iMarktbereichnr int
|
|
-- Gets: @sVersion varchar(50)
|
|
-- Gets: @bAlsProdukt bit
|
|
-- Gets: @bNurLizenz bit
|
|
-- Gets: @sPrioWiederanlauf varchar(50)
|
|
-- Gets: @sKurzbeschreibung varchar(2048)
|
|
-- Gets: @daInaktivseit datetime
|
|
-- Gets: @bRAS bit
|
|
-- Gets: @sDatenbankname varchar(50)
|
|
-- Gets: @sAnzahl_Installationen varchar(50)
|
|
-- Gets: @sTest_Aufwand varchar(50)
|
|
-- Gets: @sTest_Arbeitsplaetze varchar(255)
|
|
-- Gets: @sTest_Abhaengigkeiten varchar(255)
|
|
-- Gets: @sTest_Bemerkung varchar(1024)
|
|
-- Gets: @bTicketXPertVerwendung bit
|
|
-- Gets: @bTicketXPert_WPIAnzeigen bit
|
|
-- Gets: @sTicketXPert_Preis varchar(50)
|
|
-- Gets: @sTicketXPert_Preis_Einmalig varchar(50)
|
|
-- Gets: @bTicketXPert_AMAnzeigen bit
|
|
-- Gets: @iTicketXPert_ApplikationKritikalitaetTypNr int
|
|
-- Gets: @iTicketXPert_ApplikationSMLTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Gets: @iSensitiveDaten int
|
|
-- Gets: @sSensitiveDatenBemerkung varchar(500)
|
|
-- Gets: @iSensitiveDatenAdministriertdurch int
|
|
-- Gets: @sSensitiveDatenUeberwachungBemerkung varchar(500)
|
|
-- Gets: @iSensitiveDatenUeberwachungPeriodizitaet int
|
|
-- Gets: @sSensitiveDatenUserBemerkung varchar(500)
|
|
-- Gets: @iSensitiveDatenAnzahlComit int
|
|
-- Gets: @iSensitiveDatenAnzahlExterne int
|
|
-- Gets: @bStrukturelement bit
|
|
-- Gets: @iIKVBizRelevanzNr int
|
|
-- Gets: @iIKVBizAusfalldauerNr int
|
|
-- Gets: @sIKVBIZBemerkung varchar(1024)
|
|
-- Gets: @bIKVProviderVereinbart bit
|
|
-- Gets: @iIKVProviderAussfalldauerNr int
|
|
-- Gets: @sIKVProviderBemerkung varchar(1024)
|
|
-- Gets: @iIKVLoesungNr int
|
|
-- Gets: @sIKVLoesungBemerkung varchar(1024)
|
|
-- Gets: @iFachlicheOe int
|
|
-- Gets: @iTicketXPert_ITSPProduktnr int
|
|
-- Gets: @sIntranetBezeichnung varchar(255)
|
|
-- Gets: @bVerwendungIntragnet bit
|
|
-- Gets: @bIntranetObligatorisch bit
|
|
-- Gets: @bErstloesungsquote bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_Insert]
|
|
@iApplikationNr int,
|
|
@sBezeichnung varchar(50),
|
|
@iParentID int,
|
|
@iApplikationVerantwortungNr int,
|
|
@iApplikationKategorieNr int,
|
|
@iApplikationTeamnr int,
|
|
@iMarktbereichnr int,
|
|
@sVersion varchar(50),
|
|
@bAlsProdukt bit,
|
|
@bNurLizenz bit,
|
|
@sPrioWiederanlauf varchar(50),
|
|
@sKurzbeschreibung varchar(2048),
|
|
@daInaktivseit datetime,
|
|
@bRAS bit,
|
|
@sDatenbankname varchar(50),
|
|
@sAnzahl_Installationen varchar(50),
|
|
@sTest_Aufwand varchar(50),
|
|
@sTest_Arbeitsplaetze varchar(255),
|
|
@sTest_Abhaengigkeiten varchar(255),
|
|
@sTest_Bemerkung varchar(1024),
|
|
@bTicketXPertVerwendung bit,
|
|
@bTicketXPert_WPIAnzeigen bit,
|
|
@sTicketXPert_Preis varchar(50),
|
|
@sTicketXPert_Preis_Einmalig varchar(50),
|
|
@bTicketXPert_AMAnzeigen bit,
|
|
@iTicketXPert_ApplikationKritikalitaetTypNr int,
|
|
@iTicketXPert_ApplikationSMLTypNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSecurityLevelNr int,
|
|
@iRfcBoardNr int,
|
|
@iSensitiveDaten int,
|
|
@sSensitiveDatenBemerkung varchar(500),
|
|
@iSensitiveDatenAdministriertdurch int,
|
|
@sSensitiveDatenUeberwachungBemerkung varchar(500),
|
|
@iSensitiveDatenUeberwachungPeriodizitaet int,
|
|
@sSensitiveDatenUserBemerkung varchar(500),
|
|
@iSensitiveDatenAnzahlComit int,
|
|
@iSensitiveDatenAnzahlExterne int,
|
|
@bStrukturelement bit,
|
|
@iIKVBizRelevanzNr int,
|
|
@iIKVBizAusfalldauerNr int,
|
|
@sIKVBIZBemerkung varchar(1024),
|
|
@bIKVProviderVereinbart bit,
|
|
@iIKVProviderAussfalldauerNr int,
|
|
@sIKVProviderBemerkung varchar(1024),
|
|
@iIKVLoesungNr int,
|
|
@sIKVLoesungBemerkung varchar(1024),
|
|
@iFachlicheOe int,
|
|
@iTicketXPert_ITSPProduktnr int,
|
|
@sIntranetBezeichnung varchar(255),
|
|
@bVerwendungIntragnet bit,
|
|
@bIntranetObligatorisch bit,
|
|
@bErstloesungsquote bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Applikation]
|
|
(
|
|
[ApplikationNr],
|
|
[Bezeichnung],
|
|
[ParentID],
|
|
[ApplikationVerantwortungNr],
|
|
[ApplikationKategorieNr],
|
|
[ApplikationTeamnr],
|
|
[Marktbereichnr],
|
|
[Version],
|
|
[AlsProdukt],
|
|
[NurLizenz],
|
|
[PrioWiederanlauf],
|
|
[Kurzbeschreibung],
|
|
[Inaktivseit],
|
|
[RAS],
|
|
[Datenbankname],
|
|
[Anzahl_Installationen],
|
|
[Test_Aufwand],
|
|
[Test_Arbeitsplaetze],
|
|
[Test_Abhaengigkeiten],
|
|
[Test_Bemerkung],
|
|
[TicketXPertVerwendung],
|
|
[TicketXPert_WPIAnzeigen],
|
|
[TicketXPert_Preis],
|
|
[TicketXPert_Preis_Einmalig],
|
|
[TicketXPert_AMAnzeigen],
|
|
[TicketXPert_ApplikationKritikalitaetTypNr],
|
|
[TicketXPert_ApplikationSMLTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr],
|
|
[RfcBoardNr],
|
|
[SensitiveDaten],
|
|
[SensitiveDatenBemerkung],
|
|
[SensitiveDatenAdministriertdurch],
|
|
[SensitiveDatenUeberwachungBemerkung],
|
|
[SensitiveDatenUeberwachungPeriodizitaet],
|
|
[SensitiveDatenUserBemerkung],
|
|
[SensitiveDatenAnzahlComit],
|
|
[SensitiveDatenAnzahlExterne],
|
|
[Strukturelement],
|
|
[IKVBizRelevanzNr],
|
|
[IKVBizAusfalldauerNr],
|
|
[IKVBIZBemerkung],
|
|
[IKVProviderVereinbart],
|
|
[IKVProviderAussfalldauerNr],
|
|
[IKVProviderBemerkung],
|
|
[IKVLoesungNr],
|
|
[IKVLoesungBemerkung],
|
|
[FachlicheOe],
|
|
[TicketXPert_ITSPProduktnr],
|
|
[IntranetBezeichnung],
|
|
[VerwendungIntragnet],
|
|
[IntranetObligatorisch],
|
|
[Erstloesungsquote]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationNr,
|
|
@sBezeichnung,
|
|
@iParentID,
|
|
@iApplikationVerantwortungNr,
|
|
@iApplikationKategorieNr,
|
|
@iApplikationTeamnr,
|
|
@iMarktbereichnr,
|
|
@sVersion,
|
|
@bAlsProdukt,
|
|
@bNurLizenz,
|
|
@sPrioWiederanlauf,
|
|
@sKurzbeschreibung,
|
|
@daInaktivseit,
|
|
@bRAS,
|
|
@sDatenbankname,
|
|
@sAnzahl_Installationen,
|
|
@sTest_Aufwand,
|
|
@sTest_Arbeitsplaetze,
|
|
@sTest_Abhaengigkeiten,
|
|
@sTest_Bemerkung,
|
|
@bTicketXPertVerwendung,
|
|
@bTicketXPert_WPIAnzeigen,
|
|
@sTicketXPert_Preis,
|
|
@sTicketXPert_Preis_Einmalig,
|
|
@bTicketXPert_AMAnzeigen,
|
|
@iTicketXPert_ApplikationKritikalitaetTypNr,
|
|
@iTicketXPert_ApplikationSMLTypNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iSecurityLevelNr,
|
|
@iRfcBoardNr,
|
|
@iSensitiveDaten,
|
|
@sSensitiveDatenBemerkung,
|
|
@iSensitiveDatenAdministriertdurch,
|
|
@sSensitiveDatenUeberwachungBemerkung,
|
|
@iSensitiveDatenUeberwachungPeriodizitaet,
|
|
@sSensitiveDatenUserBemerkung,
|
|
@iSensitiveDatenAnzahlComit,
|
|
@iSensitiveDatenAnzahlExterne,
|
|
@bStrukturelement,
|
|
@iIKVBizRelevanzNr,
|
|
@iIKVBizAusfalldauerNr,
|
|
@sIKVBIZBemerkung,
|
|
@bIKVProviderVereinbart,
|
|
@iIKVProviderAussfalldauerNr,
|
|
@sIKVProviderBemerkung,
|
|
@iIKVLoesungNr,
|
|
@sIKVLoesungBemerkung,
|
|
@iFachlicheOe,
|
|
@iTicketXPert_ITSPProduktnr,
|
|
@sIntranetBezeichnung,
|
|
@bVerwendungIntragnet,
|
|
@bIntranetObligatorisch,
|
|
@bErstloesungsquote
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikation'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationNr],
|
|
[Bezeichnung],
|
|
[ParentID],
|
|
[ApplikationVerantwortungNr],
|
|
[ApplikationKategorieNr],
|
|
[ApplikationTeamnr],
|
|
[Marktbereichnr],
|
|
[Version],
|
|
[AlsProdukt],
|
|
[NurLizenz],
|
|
[PrioWiederanlauf],
|
|
[Kurzbeschreibung],
|
|
[Inaktivseit],
|
|
[RAS],
|
|
[Datenbankname],
|
|
[Anzahl_Installationen],
|
|
[Test_Aufwand],
|
|
[Test_Arbeitsplaetze],
|
|
[Test_Abhaengigkeiten],
|
|
[Test_Bemerkung],
|
|
[TicketXPertVerwendung],
|
|
[TicketXPert_WPIAnzeigen],
|
|
[TicketXPert_Preis],
|
|
[TicketXPert_Preis_Einmalig],
|
|
[TicketXPert_AMAnzeigen],
|
|
[TicketXPert_ApplikationKritikalitaetTypNr],
|
|
[TicketXPert_ApplikationSMLTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr],
|
|
[RfcBoardNr],
|
|
[SensitiveDaten],
|
|
[SensitiveDatenBemerkung],
|
|
[SensitiveDatenAdministriertdurch],
|
|
[SensitiveDatenUeberwachungBemerkung],
|
|
[SensitiveDatenUeberwachungPeriodizitaet],
|
|
[SensitiveDatenUserBemerkung],
|
|
[SensitiveDatenAnzahlComit],
|
|
[SensitiveDatenAnzahlExterne],
|
|
[Strukturelement],
|
|
[IKVBizRelevanzNr],
|
|
[IKVBizAusfalldauerNr],
|
|
[IKVBIZBemerkung],
|
|
[IKVProviderVereinbart],
|
|
[IKVProviderAussfalldauerNr],
|
|
[IKVProviderBemerkung],
|
|
[IKVLoesungNr],
|
|
[IKVLoesungBemerkung],
|
|
[FachlicheOe],
|
|
[TicketXPert_ITSPProduktnr],
|
|
[IntranetBezeichnung],
|
|
[VerwendungIntragnet],
|
|
[IntranetObligatorisch],
|
|
[Erstloesungsquote]
|
|
FROM [dbo].[Applikation]
|
|
ORDER BY
|
|
[ApplikationNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikation'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_SelectOne]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationNr],
|
|
[Bezeichnung],
|
|
[ParentID],
|
|
[ApplikationVerantwortungNr],
|
|
[ApplikationKategorieNr],
|
|
[ApplikationTeamnr],
|
|
[Marktbereichnr],
|
|
[Version],
|
|
[AlsProdukt],
|
|
[NurLizenz],
|
|
[PrioWiederanlauf],
|
|
[Kurzbeschreibung],
|
|
[Inaktivseit],
|
|
[RAS],
|
|
[Datenbankname],
|
|
[Anzahl_Installationen],
|
|
[Test_Aufwand],
|
|
[Test_Arbeitsplaetze],
|
|
[Test_Abhaengigkeiten],
|
|
[Test_Bemerkung],
|
|
[TicketXPertVerwendung],
|
|
[TicketXPert_WPIAnzeigen],
|
|
[TicketXPert_Preis],
|
|
[TicketXPert_Preis_Einmalig],
|
|
[TicketXPert_AMAnzeigen],
|
|
[TicketXPert_ApplikationKritikalitaetTypNr],
|
|
[TicketXPert_ApplikationSMLTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr],
|
|
[RfcBoardNr],
|
|
[SensitiveDaten],
|
|
[SensitiveDatenBemerkung],
|
|
[SensitiveDatenAdministriertdurch],
|
|
[SensitiveDatenUeberwachungBemerkung],
|
|
[SensitiveDatenUeberwachungPeriodizitaet],
|
|
[SensitiveDatenUserBemerkung],
|
|
[SensitiveDatenAnzahlComit],
|
|
[SensitiveDatenAnzahlExterne],
|
|
[Strukturelement],
|
|
[IKVBizRelevanzNr],
|
|
[IKVBizAusfalldauerNr],
|
|
[IKVBIZBemerkung],
|
|
[IKVProviderVereinbart],
|
|
[IKVProviderAussfalldauerNr],
|
|
[IKVProviderBemerkung],
|
|
[IKVLoesungNr],
|
|
[IKVLoesungBemerkung],
|
|
[FachlicheOe],
|
|
[TicketXPert_ITSPProduktnr],
|
|
[IntranetBezeichnung],
|
|
[VerwendungIntragnet],
|
|
[IntranetObligatorisch],
|
|
[Erstloesungsquote]
|
|
FROM [dbo].[Applikation]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikation_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikation'
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @iParentID int
|
|
-- Gets: @iApplikationVerantwortungNr int
|
|
-- Gets: @iApplikationKategorieNr int
|
|
-- Gets: @iApplikationTeamnr int
|
|
-- Gets: @iMarktbereichnr int
|
|
-- Gets: @sVersion varchar(50)
|
|
-- Gets: @bAlsProdukt bit
|
|
-- Gets: @bNurLizenz bit
|
|
-- Gets: @sPrioWiederanlauf varchar(50)
|
|
-- Gets: @sKurzbeschreibung varchar(2048)
|
|
-- Gets: @daInaktivseit datetime
|
|
-- Gets: @bRAS bit
|
|
-- Gets: @sDatenbankname varchar(50)
|
|
-- Gets: @sAnzahl_Installationen varchar(50)
|
|
-- Gets: @sTest_Aufwand varchar(50)
|
|
-- Gets: @sTest_Arbeitsplaetze varchar(255)
|
|
-- Gets: @sTest_Abhaengigkeiten varchar(255)
|
|
-- Gets: @sTest_Bemerkung varchar(1024)
|
|
-- Gets: @bTicketXPertVerwendung bit
|
|
-- Gets: @bTicketXPert_WPIAnzeigen bit
|
|
-- Gets: @sTicketXPert_Preis varchar(50)
|
|
-- Gets: @sTicketXPert_Preis_Einmalig varchar(50)
|
|
-- Gets: @bTicketXPert_AMAnzeigen bit
|
|
-- Gets: @iTicketXPert_ApplikationKritikalitaetTypNr int
|
|
-- Gets: @iTicketXPert_ApplikationSMLTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Gets: @iSensitiveDaten int
|
|
-- Gets: @sSensitiveDatenBemerkung varchar(500)
|
|
-- Gets: @iSensitiveDatenAdministriertdurch int
|
|
-- Gets: @sSensitiveDatenUeberwachungBemerkung varchar(500)
|
|
-- Gets: @iSensitiveDatenUeberwachungPeriodizitaet int
|
|
-- Gets: @sSensitiveDatenUserBemerkung varchar(500)
|
|
-- Gets: @iSensitiveDatenAnzahlComit int
|
|
-- Gets: @iSensitiveDatenAnzahlExterne int
|
|
-- Gets: @bStrukturelement bit
|
|
-- Gets: @iIKVBizRelevanzNr int
|
|
-- Gets: @iIKVBizAusfalldauerNr int
|
|
-- Gets: @sIKVBIZBemerkung varchar(1024)
|
|
-- Gets: @bIKVProviderVereinbart bit
|
|
-- Gets: @iIKVProviderAussfalldauerNr int
|
|
-- Gets: @sIKVProviderBemerkung varchar(1024)
|
|
-- Gets: @iIKVLoesungNr int
|
|
-- Gets: @sIKVLoesungBemerkung varchar(1024)
|
|
-- Gets: @iFachlicheOe int
|
|
-- Gets: @iTicketXPert_ITSPProduktnr int
|
|
-- Gets: @sIntranetBezeichnung varchar(255)
|
|
-- Gets: @bVerwendungIntragnet bit
|
|
-- Gets: @bIntranetObligatorisch bit
|
|
-- Gets: @bErstloesungsquote bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikation_Update]
|
|
@iApplikationNr int,
|
|
@sBezeichnung varchar(50),
|
|
@iParentID int,
|
|
@iApplikationVerantwortungNr int,
|
|
@iApplikationKategorieNr int,
|
|
@iApplikationTeamnr int,
|
|
@iMarktbereichnr int,
|
|
@sVersion varchar(50),
|
|
@bAlsProdukt bit,
|
|
@bNurLizenz bit,
|
|
@sPrioWiederanlauf varchar(50),
|
|
@sKurzbeschreibung varchar(2048),
|
|
@daInaktivseit datetime,
|
|
@bRAS bit,
|
|
@sDatenbankname varchar(50),
|
|
@sAnzahl_Installationen varchar(50),
|
|
@sTest_Aufwand varchar(50),
|
|
@sTest_Arbeitsplaetze varchar(255),
|
|
@sTest_Abhaengigkeiten varchar(255),
|
|
@sTest_Bemerkung varchar(1024),
|
|
@bTicketXPertVerwendung bit,
|
|
@bTicketXPert_WPIAnzeigen bit,
|
|
@sTicketXPert_Preis varchar(50),
|
|
@sTicketXPert_Preis_Einmalig varchar(50),
|
|
@bTicketXPert_AMAnzeigen bit,
|
|
@iTicketXPert_ApplikationKritikalitaetTypNr int,
|
|
@iTicketXPert_ApplikationSMLTypNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSecurityLevelNr int,
|
|
@iRfcBoardNr int,
|
|
@iSensitiveDaten int,
|
|
@sSensitiveDatenBemerkung varchar(500),
|
|
@iSensitiveDatenAdministriertdurch int,
|
|
@sSensitiveDatenUeberwachungBemerkung varchar(500),
|
|
@iSensitiveDatenUeberwachungPeriodizitaet int,
|
|
@sSensitiveDatenUserBemerkung varchar(500),
|
|
@iSensitiveDatenAnzahlComit int,
|
|
@iSensitiveDatenAnzahlExterne int,
|
|
@bStrukturelement bit,
|
|
@iIKVBizRelevanzNr int,
|
|
@iIKVBizAusfalldauerNr int,
|
|
@sIKVBIZBemerkung varchar(1024),
|
|
@bIKVProviderVereinbart bit,
|
|
@iIKVProviderAussfalldauerNr int,
|
|
@sIKVProviderBemerkung varchar(1024),
|
|
@iIKVLoesungNr int,
|
|
@sIKVLoesungBemerkung varchar(1024),
|
|
@iFachlicheOe int,
|
|
@iTicketXPert_ITSPProduktnr int,
|
|
@sIntranetBezeichnung varchar(255),
|
|
@bVerwendungIntragnet bit,
|
|
@bIntranetObligatorisch bit,
|
|
@bErstloesungsquote bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Applikation]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[ParentID] = @iParentID,
|
|
[ApplikationVerantwortungNr] = @iApplikationVerantwortungNr,
|
|
[ApplikationKategorieNr] = @iApplikationKategorieNr,
|
|
[ApplikationTeamnr] = @iApplikationTeamnr,
|
|
[Marktbereichnr] = @iMarktbereichnr,
|
|
[Version] = @sVersion,
|
|
[AlsProdukt] = @bAlsProdukt,
|
|
[NurLizenz] = @bNurLizenz,
|
|
[PrioWiederanlauf] = @sPrioWiederanlauf,
|
|
[Kurzbeschreibung] = @sKurzbeschreibung,
|
|
[Inaktivseit] = @daInaktivseit,
|
|
[RAS] = @bRAS,
|
|
[Datenbankname] = @sDatenbankname,
|
|
[Anzahl_Installationen] = @sAnzahl_Installationen,
|
|
[Test_Aufwand] = @sTest_Aufwand,
|
|
[Test_Arbeitsplaetze] = @sTest_Arbeitsplaetze,
|
|
[Test_Abhaengigkeiten] = @sTest_Abhaengigkeiten,
|
|
[Test_Bemerkung] = @sTest_Bemerkung,
|
|
[TicketXPertVerwendung] = @bTicketXPertVerwendung,
|
|
[TicketXPert_WPIAnzeigen] = @bTicketXPert_WPIAnzeigen,
|
|
[TicketXPert_Preis] = @sTicketXPert_Preis,
|
|
[TicketXPert_Preis_Einmalig] = @sTicketXPert_Preis_Einmalig,
|
|
[TicketXPert_AMAnzeigen] = @bTicketXPert_AMAnzeigen,
|
|
[TicketXPert_ApplikationKritikalitaetTypNr] = @iTicketXPert_ApplikationKritikalitaetTypNr,
|
|
[TicketXPert_ApplikationSMLTypNr] = @iTicketXPert_ApplikationSMLTypNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[RfcBoardNr] = @iRfcBoardNr,
|
|
[SensitiveDaten] = @iSensitiveDaten,
|
|
[SensitiveDatenBemerkung] = @sSensitiveDatenBemerkung,
|
|
[SensitiveDatenAdministriertdurch] = @iSensitiveDatenAdministriertdurch,
|
|
[SensitiveDatenUeberwachungBemerkung] = @sSensitiveDatenUeberwachungBemerkung,
|
|
[SensitiveDatenUeberwachungPeriodizitaet] = @iSensitiveDatenUeberwachungPeriodizitaet,
|
|
[SensitiveDatenUserBemerkung] = @sSensitiveDatenUserBemerkung,
|
|
[SensitiveDatenAnzahlComit] = @iSensitiveDatenAnzahlComit,
|
|
[SensitiveDatenAnzahlExterne] = @iSensitiveDatenAnzahlExterne,
|
|
[Strukturelement] = @bStrukturelement,
|
|
[IKVBizRelevanzNr] = @iIKVBizRelevanzNr,
|
|
[IKVBizAusfalldauerNr] = @iIKVBizAusfalldauerNr,
|
|
[IKVBIZBemerkung] = @sIKVBIZBemerkung,
|
|
[IKVProviderVereinbart] = @bIKVProviderVereinbart,
|
|
[IKVProviderAussfalldauerNr] = @iIKVProviderAussfalldauerNr,
|
|
[IKVProviderBemerkung] = @sIKVProviderBemerkung,
|
|
[IKVLoesungNr] = @iIKVLoesungNr,
|
|
[IKVLoesungBemerkung] = @sIKVLoesungBemerkung,
|
|
[FachlicheOe] = @iFachlicheOe,
|
|
[TicketXPert_ITSPProduktnr] = @iTicketXPert_ITSPProduktnr,
|
|
[IntranetBezeichnung] = @sIntranetBezeichnung,
|
|
[VerwendungIntragnet] = @bVerwendungIntragnet,
|
|
[IntranetObligatorisch] = @bIntranetObligatorisch,
|
|
[Erstloesungsquote] = @bErstloesungsquote
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationabhaengigkeit_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Applikationabhaengigkeit'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationAbhaengigkeitNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikationabhaengigkeit_Delete]
|
|
@iApplikationAbhaengigkeitNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Applikationabhaengigkeit]
|
|
WHERE
|
|
[ApplikationAbhaengigkeitNr] = @iApplikationAbhaengigkeitNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationabhaengigkeit_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Applikationabhaengigkeit'
|
|
-- Gets: @iApplikationAbhaengigkeitNr int
|
|
-- Gets: @iApplikationnr1 int
|
|
-- Gets: @iApplikationnr2 int
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikationabhaengigkeit_Insert]
|
|
@iApplikationAbhaengigkeitNr int,
|
|
@iApplikationnr1 int,
|
|
@iApplikationnr2 int,
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Applikationabhaengigkeit]
|
|
(
|
|
[ApplikationAbhaengigkeitNr],
|
|
[Applikationnr1],
|
|
[Applikationnr2],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationAbhaengigkeitNr,
|
|
@iApplikationnr1,
|
|
@iApplikationnr2,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iSecurityLevelNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationabhaengigkeit_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationabhaengigkeit'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikationabhaengigkeit_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationAbhaengigkeitNr],
|
|
[Applikationnr1],
|
|
[Applikationnr2],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Applikationabhaengigkeit]
|
|
ORDER BY
|
|
[ApplikationAbhaengigkeitNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationabhaengigkeit_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationabhaengigkeit'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_Applikationabhaengigkeit_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
SELECT dbo.Applikationabhaengigkeit.ApplikationAbhaengigkeitNr, dbo.Applikationabhaengigkeit.Applikationnr2, dbo.Applikation.Bezeichnung,
|
|
dbo.Applikationabhaengigkeit.Beschreibung, dbo.Applikationabhaengigkeit.Aktiv, dbo.Applikationabhaengigkeit.Erstellt_am, dbo.Applikationabhaengigkeit.Mutiert_am,
|
|
dbo.Applikationabhaengigkeit.Mutierer, dbo.Applikationabhaengigkeit.SecurityLevelNr
|
|
FROM dbo.Applikationabhaengigkeit INNER JOIN
|
|
dbo.Applikation ON dbo.Applikationabhaengigkeit.Applikationnr2 = dbo.Applikation.ApplikationNr
|
|
where dbo.applikationabhaengigkeit.applikationnr1=@keyvalue and dbo.Applikationabhaengigkeit.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationabhaengigkeit_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Applikationabhaengigkeit'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationAbhaengigkeitNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikationabhaengigkeit_SelectOne]
|
|
@iApplikationAbhaengigkeitNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationAbhaengigkeitNr],
|
|
[Applikationnr1],
|
|
[Applikationnr2],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Applikationabhaengigkeit]
|
|
WHERE
|
|
[ApplikationAbhaengigkeitNr] = @iApplikationAbhaengigkeitNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationabhaengigkeit_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Applikationabhaengigkeit'
|
|
-- Gets: @iApplikationAbhaengigkeitNr int
|
|
-- Gets: @iApplikationnr1 int
|
|
-- Gets: @iApplikationnr2 int
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Applikationabhaengigkeit_Update]
|
|
@iApplikationAbhaengigkeitNr int,
|
|
@iApplikationnr1 int,
|
|
@iApplikationnr2 int,
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Applikationabhaengigkeit]
|
|
SET
|
|
[Applikationnr1] = @iApplikationnr1,
|
|
[Applikationnr2] = @iApplikationnr2,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
WHERE
|
|
[ApplikationAbhaengigkeitNr] = @iApplikationAbhaengigkeitNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationAbhaengigkeitTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationAbhaengigkeitTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationAbhaengigkeitTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationAbhaengigkeitTyp_Delete]
|
|
@iApplikationAbhaengigkeitTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationAbhaengigkeitTyp]
|
|
WHERE
|
|
[ApplikationAbhaengigkeitTypNr] = @iApplikationAbhaengigkeitTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationAbhaengigkeitTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationAbhaengigkeitTyp'
|
|
-- Gets: @iApplikationAbhaengigkeitTypNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationAbhaengigkeitTyp_Insert]
|
|
@iApplikationAbhaengigkeitTypNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[ApplikationAbhaengigkeitTyp]
|
|
(
|
|
[ApplikationAbhaengigkeitTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationAbhaengigkeitTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationAbhaengigkeitTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationAbhaengigkeitTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationAbhaengigkeitTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationAbhaengigkeitTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationAbhaengigkeitTyp]
|
|
ORDER BY
|
|
[ApplikationAbhaengigkeitTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationAbhaengigkeitTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationAbhaengigkeitTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationAbhaengigkeitTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationAbhaengigkeitTyp_SelectOne]
|
|
@iApplikationAbhaengigkeitTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationAbhaengigkeitTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationAbhaengigkeitTyp]
|
|
WHERE
|
|
[ApplikationAbhaengigkeitTypNr] = @iApplikationAbhaengigkeitTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationAbhaengigkeitTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationAbhaengigkeitTyp'
|
|
-- Gets: @iApplikationAbhaengigkeitTypNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationAbhaengigkeitTyp_Update]
|
|
@iApplikationAbhaengigkeitTypNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[ApplikationAbhaengigkeitTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationAbhaengigkeitTypNr] = @iApplikationAbhaengigkeitTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationApplikationAbhaengigkeit int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_Delete]
|
|
@iApplikationApplikationAbhaengigkeit int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
WHERE
|
|
[ApplikationApplikationAbhaengigkeit] = @iApplikationApplikationAbhaengigkeit
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_DeleteAllWApplikationAbhaengigkeitTypLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationAbhaengigkeitTyp int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_DeleteAllWApplikationAbhaengigkeitTypLogic]
|
|
@iApplikationAbhaengigkeitTyp int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
WHERE
|
|
[ApplikationAbhaengigkeitTyp] = @iApplikationAbhaengigkeitTyp
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_DeleteAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_DeleteAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationAbhaengigkeitTyp int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iApplikationApplikationAbhaengigkeit int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_Insert]
|
|
@iApplikationNr int,
|
|
@iApplikationAbhaengigkeitTyp int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationApplikationAbhaengigkeit int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
(
|
|
[ApplikationNr],
|
|
[ApplikationAbhaengigkeitTyp],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationNr,
|
|
@iApplikationAbhaengigkeitTyp,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iApplikationApplikationAbhaengigkeit=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationApplikationAbhaengigkeit],
|
|
[ApplikationNr],
|
|
[ApplikationAbhaengigkeitTyp],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
ORDER BY
|
|
[ApplikationApplikationAbhaengigkeit] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectAllWApplikationAbhaengigkeitTypLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationAbhaengigkeitTyp int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectAllWApplikationAbhaengigkeitTypLogic]
|
|
@iApplikationAbhaengigkeitTyp int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationApplikationAbhaengigkeit],
|
|
[ApplikationNr],
|
|
[ApplikationAbhaengigkeitTyp],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
WHERE
|
|
[ApplikationAbhaengigkeitTyp] = @iApplikationAbhaengigkeitTyp
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationApplikationAbhaengigkeit],
|
|
[ApplikationNr],
|
|
[ApplikationAbhaengigkeitTyp],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationApplikationAbhaengigkeit int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_SelectOne]
|
|
@iApplikationApplikationAbhaengigkeit int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationApplikationAbhaengigkeit],
|
|
[ApplikationNr],
|
|
[ApplikationAbhaengigkeitTyp],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
WHERE
|
|
[ApplikationApplikationAbhaengigkeit] = @iApplikationApplikationAbhaengigkeit
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationApplikationAbhaengigkeit'
|
|
-- Gets: @iApplikationApplikationAbhaengigkeit int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationAbhaengigkeitTyp int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_Update]
|
|
@iApplikationApplikationAbhaengigkeit int,
|
|
@iApplikationNr int,
|
|
@iApplikationAbhaengigkeitTyp 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].[ApplikationApplikationAbhaengigkeit]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr,
|
|
[ApplikationAbhaengigkeitTyp] = @iApplikationAbhaengigkeitTyp,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationApplikationAbhaengigkeit] = @iApplikationApplikationAbhaengigkeit
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_UpdateAllWApplikationAbhaengigkeitTypLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationApplikationAbhaengigkeit'.
|
|
-- Will reset field [ApplikationAbhaengigkeitTyp] with value @iApplikationAbhaengigkeitTypOld to value @iApplikationAbhaengigkeitTyp
|
|
-- Gets: @iApplikationAbhaengigkeitTyp int
|
|
-- Gets: @iApplikationAbhaengigkeitTypOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_UpdateAllWApplikationAbhaengigkeitTypLogic]
|
|
@iApplikationAbhaengigkeitTyp int,
|
|
@iApplikationAbhaengigkeitTypOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
SET
|
|
[ApplikationAbhaengigkeitTyp] = @iApplikationAbhaengigkeitTyp
|
|
WHERE
|
|
[ApplikationAbhaengigkeitTyp] = @iApplikationAbhaengigkeitTypOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationApplikationAbhaengigkeit_UpdateAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationApplikationAbhaengigkeit'.
|
|
-- Will reset field [ApplikationNr] with value @iApplikationNrOld to value @iApplikationNr
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationApplikationAbhaengigkeit_UpdateAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iApplikationNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationApplikationAbhaengigkeit]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationInstallationAls'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationInstallationAlsTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_Delete]
|
|
@iApplikationInstallationAlsTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationInstallationAls]
|
|
WHERE
|
|
[ApplikationInstallationAlsTypNr] = @iApplikationInstallationAlsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_DeleteAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationInstallationAls'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_DeleteAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationInstallationAls]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_DeleteAllWInstallationalsTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationInstallationAls'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iInstallationalsTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_DeleteAllWInstallationalsTypNrLogic]
|
|
@iInstallationalsTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationInstallationAls]
|
|
WHERE
|
|
[InstallationalsTypNr] = @iInstallationalsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationInstallationAls'
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iInstallationalsTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iApplikationInstallationAlsTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_Insert]
|
|
@iApplikationNr int,
|
|
@iInstallationalsTypNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationInstallationAlsTypNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ApplikationInstallationAls]
|
|
(
|
|
[ApplikationNr],
|
|
[InstallationalsTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationNr,
|
|
@iInstallationalsTypNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iApplikationInstallationAlsTypNr=SCOPE_IDENTITY()
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationInstallationAls'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationAlsTypNr],
|
|
[ApplikationNr],
|
|
[InstallationalsTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationAls]
|
|
ORDER BY
|
|
[ApplikationInstallationAlsTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_SelectAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationInstallationAls'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_SelectAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationAlsTypNr],
|
|
[ApplikationNr],
|
|
[InstallationalsTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationAls]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_SelectAllWInstallationalsTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationInstallationAls'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iInstallationalsTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_SelectAllWInstallationalsTypNrLogic]
|
|
@iInstallationalsTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationAlsTypNr],
|
|
[ApplikationNr],
|
|
[InstallationalsTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationAls]
|
|
WHERE
|
|
[InstallationalsTypNr] = @iInstallationalsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationInstallationAls'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationInstallationAlsTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_SelectOne]
|
|
@iApplikationInstallationAlsTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationInstallationAlsTypNr],
|
|
[ApplikationNr],
|
|
[InstallationalsTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationAls]
|
|
WHERE
|
|
[ApplikationInstallationAlsTypNr] = @iApplikationInstallationAlsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationInstallationAls'
|
|
-- Gets: @iApplikationInstallationAlsTypNr int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iInstallationalsTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_Update]
|
|
@iApplikationInstallationAlsTypNr int,
|
|
@iApplikationNr int,
|
|
@iInstallationalsTypNr 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].[ApplikationInstallationAls]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr,
|
|
[InstallationalsTypNr] = @iInstallationalsTypNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationInstallationAlsTypNr] = @iApplikationInstallationAlsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_UpdateAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationInstallationAls'.
|
|
-- Will reset field [ApplikationNr] with value @iApplikationNrOld to value @iApplikationNr
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_UpdateAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iApplikationNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationInstallationAls]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationAls_UpdateAllWInstallationalsTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationInstallationAls'.
|
|
-- Will reset field [InstallationalsTypNr] with value @iInstallationalsTypNrOld to value @iInstallationalsTypNr
|
|
-- Gets: @iInstallationalsTypNr int
|
|
-- Gets: @iInstallationalsTypNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationAls_UpdateAllWInstallationalsTypNrLogic]
|
|
@iInstallationalsTypNr int,
|
|
@iInstallationalsTypNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationInstallationAls]
|
|
SET
|
|
[InstallationalsTypNr] = @iInstallationalsTypNr
|
|
WHERE
|
|
[InstallationalsTypNr] = @iInstallationalsTypNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationInstallationFuer'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationInstallationFuerNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_Delete]
|
|
@iApplikationInstallationFuerNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationInstallationFuer]
|
|
WHERE
|
|
[ApplikationInstallationFuerNr] = @iApplikationInstallationFuerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_DeleteAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationInstallationFuer'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_DeleteAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationInstallationFuer]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_DeleteAllWApplikationStandardTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationInstallationFuer'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_DeleteAllWApplikationStandardTypNrLogic]
|
|
@iApplikationStandardTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationInstallationFuer]
|
|
WHERE
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationInstallationFuer'
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iApplikationInstallationFuerNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_Insert]
|
|
@iApplikationNr int,
|
|
@iApplikationStandardTypNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationInstallationFuerNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ApplikationInstallationFuer]
|
|
(
|
|
[ApplikationNr],
|
|
[ApplikationStandardTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationNr,
|
|
@iApplikationStandardTypNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iApplikationInstallationFuerNr=SCOPE_IDENTITY()
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationInstallationFuer'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationFuerNr],
|
|
[ApplikationNr],
|
|
[ApplikationStandardTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationFuer]
|
|
ORDER BY
|
|
[ApplikationInstallationFuerNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_SelectAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationInstallationFuer'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_SelectAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationFuerNr],
|
|
[ApplikationNr],
|
|
[ApplikationStandardTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationFuer]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_SelectAllWApplikationStandardTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationInstallationFuer'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_SelectAllWApplikationStandardTypNrLogic]
|
|
@iApplikationStandardTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationFuerNr],
|
|
[ApplikationNr],
|
|
[ApplikationStandardTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationFuer]
|
|
WHERE
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationInstallationFuer'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationInstallationFuerNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_SelectOne]
|
|
@iApplikationInstallationFuerNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationInstallationFuerNr],
|
|
[ApplikationNr],
|
|
[ApplikationStandardTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationFuer]
|
|
WHERE
|
|
[ApplikationInstallationFuerNr] = @iApplikationInstallationFuerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationInstallationFuer'
|
|
-- Gets: @iApplikationInstallationFuerNr int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_Update]
|
|
@iApplikationInstallationFuerNr int,
|
|
@iApplikationNr int,
|
|
@iApplikationStandardTypNr 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].[ApplikationInstallationFuer]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr,
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationInstallationFuerNr] = @iApplikationInstallationFuerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_UpdateAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationInstallationFuer'.
|
|
-- Will reset field [ApplikationNr] with value @iApplikationNrOld to value @iApplikationNr
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_UpdateAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iApplikationNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationInstallationFuer]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationFuer_UpdateAllWApplikationStandardTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationInstallationFuer'.
|
|
-- Will reset field [ApplikationStandardTypNr] with value @iApplikationStandardTypNrOld to value @iApplikationStandardTypNr
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Gets: @iApplikationStandardTypNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationFuer_UpdateAllWApplikationStandardTypNrLogic]
|
|
@iApplikationStandardTypNr int,
|
|
@iApplikationStandardTypNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationInstallationFuer]
|
|
SET
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNr
|
|
WHERE
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationInstallationTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationInstallationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_Delete]
|
|
@iApplikationInstallationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationInstallationTyp]
|
|
WHERE
|
|
[ApplikationInstallationNr] = @iApplikationInstallationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_DeleteAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationInstallationTyp'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_DeleteAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationInstallationTyp]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_DeleteAllWInstallationTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'ApplikationInstallationTyp'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_DeleteAllWInstallationTypNrLogic]
|
|
@iInstallationTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[ApplikationInstallationTyp]
|
|
WHERE
|
|
[InstallationTypNr] = @iInstallationTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationInstallationTyp'
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iApplikationInstallationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_Insert]
|
|
@iApplikationNr int,
|
|
@iInstallationTypNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationInstallationNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ApplikationInstallationTyp]
|
|
(
|
|
[ApplikationNr],
|
|
[InstallationTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationNr,
|
|
@iInstallationTypNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iApplikationInstallationNr=SCOPE_IDENTITY()
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationInstallationTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationNr],
|
|
[ApplikationNr],
|
|
[InstallationTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationTyp]
|
|
ORDER BY
|
|
[ApplikationInstallationNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_SelectAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationInstallationTyp'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_SelectAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationNr],
|
|
[ApplikationNr],
|
|
[InstallationTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationTyp]
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNr
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_SelectAllWInstallationTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'ApplikationInstallationTyp'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_SelectAllWInstallationTypNrLogic]
|
|
@iInstallationTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[ApplikationInstallationNr],
|
|
[ApplikationNr],
|
|
[InstallationTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationTyp]
|
|
WHERE
|
|
[InstallationTypNr] = @iInstallationTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationInstallationTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationInstallationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_SelectOne]
|
|
@iApplikationInstallationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationInstallationNr],
|
|
[ApplikationNr],
|
|
[InstallationTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationInstallationTyp]
|
|
WHERE
|
|
[ApplikationInstallationNr] = @iApplikationInstallationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationInstallationTyp'
|
|
-- Gets: @iApplikationInstallationNr int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_Update]
|
|
@iApplikationInstallationNr int,
|
|
@iApplikationNr int,
|
|
@iInstallationTypNr 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].[ApplikationInstallationTyp]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr,
|
|
[InstallationTypNr] = @iInstallationTypNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationInstallationNr] = @iApplikationInstallationNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_UpdateAllWApplikationNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationInstallationTyp'.
|
|
-- Will reset field [ApplikationNr] with value @iApplikationNrOld to value @iApplikationNr
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iApplikationNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_UpdateAllWApplikationNrLogic]
|
|
@iApplikationNr int,
|
|
@iApplikationNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationInstallationTyp]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr
|
|
WHERE
|
|
[ApplikationNr] = @iApplikationNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationInstallationTyp_UpdateAllWInstallationTypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'ApplikationInstallationTyp'.
|
|
-- Will reset field [InstallationTypNr] with value @iInstallationTypNrOld to value @iInstallationTypNr
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Gets: @iInstallationTypNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationInstallationTyp_UpdateAllWInstallationTypNrLogic]
|
|
@iInstallationTypNr int,
|
|
@iInstallationTypNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationInstallationTyp]
|
|
SET
|
|
[InstallationTypNr] = @iInstallationTypNr
|
|
WHERE
|
|
[InstallationTypNr] = @iInstallationTypNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKategorie_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationKategorie'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationKategorieNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKategorie_Delete]
|
|
@iApplikationKategorieNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationKategorie]
|
|
WHERE
|
|
[ApplikationKategorieNr] = @iApplikationKategorieNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKategorie_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationKategorie'
|
|
-- Gets: @iApplikationKategorieNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutier_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKategorie_Insert]
|
|
@iApplikationKategorieNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutier_am datetime,
|
|
@iMutierer int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ApplikationKategorie]
|
|
(
|
|
[ApplikationKategorieNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutier_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationKategorieNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutier_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKategorie_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationKategorie'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKategorie_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationKategorieNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutier_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationKategorie]
|
|
ORDER BY
|
|
[ApplikationKategorieNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKategorie_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationKategorie'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationKategorieNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKategorie_SelectOne]
|
|
@iApplikationKategorieNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationKategorieNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutier_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationKategorie]
|
|
WHERE
|
|
[ApplikationKategorieNr] = @iApplikationKategorieNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKategorie_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationKategorie'
|
|
-- Gets: @iApplikationKategorieNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutier_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKategorie_Update]
|
|
@iApplikationKategorieNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutier_am datetime,
|
|
@iMutierer int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationKategorie]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutier_am] = @daMutier_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationKategorieNr] = @iApplikationKategorieNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKontakt_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationKontakt'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationKontaktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKontakt_Delete]
|
|
@iApplikationKontaktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationKontakt]
|
|
WHERE
|
|
[ApplikationKontaktnr] = @iApplikationKontaktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKontakt_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationKontakt'
|
|
-- Gets: @iApplikationKontaktnr int
|
|
-- Gets: @iApplikationnr int
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @iKontakttypNr int
|
|
-- Gets: @bIntern bit
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKontakt_Insert]
|
|
@iApplikationKontaktnr int,
|
|
@iApplikationnr int,
|
|
@iPersonNr int,
|
|
@iKontakttypNr int,
|
|
@bIntern bit,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ApplikationKontakt]
|
|
(
|
|
[ApplikationKontaktnr],
|
|
[Applikationnr],
|
|
[PersonNr],
|
|
[KontakttypNr],
|
|
[Intern],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationKontaktnr,
|
|
@iApplikationnr,
|
|
@iPersonNr,
|
|
@iKontakttypNr,
|
|
@bIntern,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@iSecurityLevelNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKontakt_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationKontakt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKontakt_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationKontaktnr],
|
|
[Applikationnr],
|
|
[PersonNr],
|
|
[KontakttypNr],
|
|
[Intern],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[ApplikationKontakt]
|
|
ORDER BY
|
|
[ApplikationKontaktnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationkontakt_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[pr_Applikationkontakt_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationkontakt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
|
|
|
|
SELECT dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Firma,
|
|
dbo.Person.Name + ' ' + dbo.Person.Vorname AS Kontaktperson, dbo.Person.Telefon, dbo.Person.Telefax, dbo.Person.EMail,
|
|
dbo.Kontakttyp.Bezeichnung AS Rolle, dbo.Applikationkontakt.Intern, dbo.Applikationkontakt.Bemerkung, dbo.Applikationkontakt.Aktiv,
|
|
dbo.Applikationkontakt.Erstellt_am, dbo.Applikationkontakt.Mutiert_am, dbo.Applikationkontakt.Mutierer, dbo.Applikationkontakt.Mandantnr,
|
|
dbo.Applikationkontakt.SecurityLevelNr, dbo.Applikationkontakt.PersonNr, dbo.Applikationkontakt.ApplikationkontaktNr
|
|
,
|
|
dbo.Person.Internet as Internet, dbo.Person.Bemerkung as PersonBemerkung
|
|
FROM dbo.Applikationkontakt INNER JOIN
|
|
dbo.Person ON dbo.Applikationkontakt.PersonNr = dbo.Person.PersonNr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Person.Vertragspartnernr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Kontakttyp ON dbo.Applikationkontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr
|
|
where dbo.Applikationkontakt.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and Applikationnr = @keyvalue
|
|
ORDER BY
|
|
[Applikationkontaktnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKontakt_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationKontakt'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationKontaktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKontakt_SelectOne]
|
|
@iApplikationKontaktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationKontaktnr],
|
|
[Applikationnr],
|
|
[PersonNr],
|
|
[KontakttypNr],
|
|
[Intern],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[ApplikationKontakt]
|
|
WHERE
|
|
[ApplikationKontaktnr] = @iApplikationKontaktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKontakt_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationKontakt'
|
|
-- Gets: @iApplikationKontaktnr int
|
|
-- Gets: @iApplikationnr int
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @iKontakttypNr int
|
|
-- Gets: @bIntern bit
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKontakt_Update]
|
|
@iApplikationKontaktnr int,
|
|
@iApplikationnr int,
|
|
@iPersonNr int,
|
|
@iKontakttypNr int,
|
|
@bIntern bit,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationKontakt]
|
|
SET
|
|
[Applikationnr] = @iApplikationnr,
|
|
[PersonNr] = @iPersonNr,
|
|
[KontakttypNr] = @iKontakttypNr,
|
|
[Intern] = @bIntern,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
WHERE
|
|
[ApplikationKontaktnr] = @iApplikationKontaktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKritikalitaetTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationKritikalitaetTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationKritikalitaetTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKritikalitaetTyp_Delete]
|
|
@iApplikationKritikalitaetTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationKritikalitaetTyp]
|
|
WHERE
|
|
[ApplikationKritikalitaetTypNr] = @iApplikationKritikalitaetTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKritikalitaetTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationKritikalitaetTyp'
|
|
-- Gets: @iApplikationKritikalitaetTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKritikalitaetTyp_Insert]
|
|
@iApplikationKritikalitaetTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[ApplikationKritikalitaetTyp]
|
|
(
|
|
[ApplikationKritikalitaetTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationKritikalitaetTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKritikalitaetTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationKritikalitaetTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKritikalitaetTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationKritikalitaetTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationKritikalitaetTyp]
|
|
ORDER BY
|
|
[ApplikationKritikalitaetTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKritikalitaetTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationKritikalitaetTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationKritikalitaetTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKritikalitaetTyp_SelectOne]
|
|
@iApplikationKritikalitaetTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationKritikalitaetTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationKritikalitaetTyp]
|
|
WHERE
|
|
[ApplikationKritikalitaetTypNr] = @iApplikationKritikalitaetTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationKritikalitaetTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationKritikalitaetTyp'
|
|
-- Gets: @iApplikationKritikalitaetTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationKritikalitaetTyp_Update]
|
|
@iApplikationKritikalitaetTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[ApplikationKritikalitaetTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationKritikalitaetTypNr] = @iApplikationKritikalitaetTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationLogbuch_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationLogbuch'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationLogbuchNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationLogbuch_Delete]
|
|
@iApplikationLogbuchNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationLogbuch]
|
|
WHERE
|
|
[ApplikationLogbuchNr] = @iApplikationLogbuchNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationLogbuch_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationLogbuch'
|
|
-- Gets: @iApplikationLogbuchNr int
|
|
-- Gets: @daReleasedatum datetime
|
|
-- Gets: @sBezeichnung varchar(1024)
|
|
-- Gets: @iReleaseartnr int
|
|
-- Gets: @sBemerkung varchar(1024)
|
|
-- Gets: @iAbnahmeFBPerson int
|
|
-- Gets: @daAbnahmeFBDatum datetime
|
|
-- Gets: @iAbnahmeTecPerson int
|
|
-- Gets: @daAbnahmeTecDatum datetime
|
|
-- Gets: @iFreigabedurch int
|
|
-- Gets: @daFreigabeDatum datetime
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationLogbuch_Insert]
|
|
@iApplikationLogbuchNr int,
|
|
@daReleasedatum datetime,
|
|
@sBezeichnung varchar(1024),
|
|
@iReleaseartnr int,
|
|
@sBemerkung varchar(1024),
|
|
@iAbnahmeFBPerson int,
|
|
@daAbnahmeFBDatum datetime,
|
|
@iAbnahmeTecPerson int,
|
|
@daAbnahmeTecDatum datetime,
|
|
@iFreigabedurch int,
|
|
@daFreigabeDatum datetime,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ApplikationLogbuch]
|
|
(
|
|
[ApplikationLogbuchNr],
|
|
[Releasedatum],
|
|
[Bezeichnung],
|
|
[Releaseartnr],
|
|
[Bemerkung],
|
|
[AbnahmeFBPerson],
|
|
[AbnahmeFBDatum],
|
|
[AbnahmeTecPerson],
|
|
[AbnahmeTecDatum],
|
|
[Freigabedurch],
|
|
[FreigabeDatum],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[ApplikationNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationLogbuchNr,
|
|
@daReleasedatum,
|
|
@sBezeichnung,
|
|
@iReleaseartnr,
|
|
@sBemerkung,
|
|
@iAbnahmeFBPerson,
|
|
@daAbnahmeFBDatum,
|
|
@iAbnahmeTecPerson,
|
|
@daAbnahmeTecDatum,
|
|
@iFreigabedurch,
|
|
@daFreigabeDatum,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iApplikationNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationLogbuch_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationLogbuch'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationLogbuch_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationLogbuchNr],
|
|
[Releasedatum],
|
|
[Bezeichnung],
|
|
[Releaseartnr],
|
|
[Bemerkung],
|
|
[AbnahmeFBPerson],
|
|
[AbnahmeFBDatum],
|
|
[AbnahmeTecPerson],
|
|
[AbnahmeTecDatum],
|
|
[Freigabedurch],
|
|
[FreigabeDatum],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[ApplikationNr]
|
|
FROM [dbo].[ApplikationLogbuch]
|
|
ORDER BY
|
|
[ApplikationLogbuchNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationLogbuch_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE proc [dbo].[pr_ApplikationLogbuch_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationkontakt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
|
|
|
|
SELECT dbo.ApplikationLogbuch.ApplikationLogbuchNr, dbo.ApplikationLogbuch.Releasedatum, dbo.ApplikationLogbuch.Bezeichnung, dbo.ReleaseArt.Bezeichnung AS Releaseart,
|
|
Person_1.Name + ' ' + Person_1.Vorname AS AbnahmeFB, dbo.Person.Name + ' ' + Person.Vorname AS AbnahmeTec,
|
|
Person_2.Name + ' ' + Person_2.Vorname AS Freigabedurch, dbo.ApplikationLogbuch.AbnahmeFBDatum, dbo.ApplikationLogbuch.AbnahmeTecDatum,
|
|
dbo.ApplikationLogbuch.FreigabeDatum, dbo.ApplikationLogbuch.Aktiv, dbo.ApplikationLogbuch.Erstellt_am, dbo.ApplikationLogbuch.Mutiert_am,
|
|
dbo.ApplikationLogbuch.Mutierer, dbo.ApplikationLogbuch.ApplikationNr
|
|
FROM dbo.Person AS Person_1 RIGHT OUTER JOIN
|
|
dbo.Person RIGHT OUTER JOIN
|
|
dbo.ApplikationLogbuch INNER JOIN
|
|
dbo.ReleaseArt ON dbo.ApplikationLogbuch.Releaseartnr = dbo.ReleaseArt.Releaseartnr LEFT OUTER JOIN
|
|
dbo.Person AS Person_2 ON dbo.ApplikationLogbuch.Freigabedurch = Person_2.PersonNr ON dbo.Person.PersonNr = dbo.ApplikationLogbuch.AbnahmeTecPerson ON
|
|
Person_1.PersonNr = dbo.ApplikationLogbuch.AbnahmeFBPerson
|
|
WHERE dbo.ApplikationLogbuch.ApplikationNr = @keyvalue
|
|
ORDER BY
|
|
[Releasedatum] desc
|
|
SELECT @iErrorCode=@@ERROR
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationLogbuch_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationLogbuch'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationLogbuchNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationLogbuch_SelectOne]
|
|
@iApplikationLogbuchNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationLogbuchNr],
|
|
[Releasedatum],
|
|
[Bezeichnung],
|
|
[Releaseartnr],
|
|
[Bemerkung],
|
|
[AbnahmeFBPerson],
|
|
[AbnahmeFBDatum],
|
|
[AbnahmeTecPerson],
|
|
[AbnahmeTecDatum],
|
|
[Freigabedurch],
|
|
[FreigabeDatum],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[ApplikationNr]
|
|
FROM [dbo].[ApplikationLogbuch]
|
|
WHERE
|
|
[ApplikationLogbuchNr] = @iApplikationLogbuchNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationLogbuch_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationLogbuch'
|
|
-- Gets: @iApplikationLogbuchNr int
|
|
-- Gets: @daReleasedatum datetime
|
|
-- Gets: @sBezeichnung varchar(1024)
|
|
-- Gets: @iReleaseartnr int
|
|
-- Gets: @sBemerkung varchar(1024)
|
|
-- Gets: @iAbnahmeFBPerson int
|
|
-- Gets: @daAbnahmeFBDatum datetime
|
|
-- Gets: @iAbnahmeTecPerson int
|
|
-- Gets: @daAbnahmeTecDatum datetime
|
|
-- Gets: @iFreigabedurch int
|
|
-- Gets: @daFreigabeDatum datetime
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iApplikationNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationLogbuch_Update]
|
|
@iApplikationLogbuchNr int,
|
|
@daReleasedatum datetime,
|
|
@sBezeichnung varchar(1024),
|
|
@iReleaseartnr int,
|
|
@sBemerkung varchar(1024),
|
|
@iAbnahmeFBPerson int,
|
|
@daAbnahmeFBDatum datetime,
|
|
@iAbnahmeTecPerson int,
|
|
@daAbnahmeTecDatum datetime,
|
|
@iFreigabedurch int,
|
|
@daFreigabeDatum datetime,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ApplikationLogbuch]
|
|
SET
|
|
[Releasedatum] = @daReleasedatum,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Releaseartnr] = @iReleaseartnr,
|
|
[Bemerkung] = @sBemerkung,
|
|
[AbnahmeFBPerson] = @iAbnahmeFBPerson,
|
|
[AbnahmeFBDatum] = @daAbnahmeFBDatum,
|
|
[AbnahmeTecPerson] = @iAbnahmeTecPerson,
|
|
[AbnahmeTecDatum] = @daAbnahmeTecDatum,
|
|
[Freigabedurch] = @iFreigabedurch,
|
|
[FreigabeDatum] = @daFreigabeDatum,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[ApplikationNr] = @iApplikationNr
|
|
WHERE
|
|
[ApplikationLogbuchNr] = @iApplikationLogbuchNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Applikationrelease_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE proc [dbo].[pr_Applikationrelease_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationkontakt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
|
|
|
|
SELECT dbo.ApplikationLogbuch.ApplikationLogbuchNr, dbo.ApplikationLogbuch.Releasedatum, dbo.ApplikationLogbuch.Bezeichnung, dbo.ReleaseArt.Bezeichnung AS Releaseart,
|
|
Person_1.Name + ' ' + Person_1.Vorname AS AbnahmeFB, dbo.Person.Name + ' ' + Person_1.Vorname AS AbnahmeTec,
|
|
Person_2.Name + ' ' + Person_2.Vorname AS Freigabedurch, dbo.ApplikationLogbuch.AbnahmeFBDatum, dbo.ApplikationLogbuch.AbnahmeTecDatum,
|
|
dbo.ApplikationLogbuch.FreigabeDatum, dbo.ApplikationLogbuch.Aktiv, dbo.ApplikationLogbuch.Erstellt_am, dbo.ApplikationLogbuch.Mutiert_am,
|
|
dbo.ApplikationLogbuch.Mutierer, dbo.ApplikationLogbuch.ApplikationNr
|
|
FROM dbo.Person AS Person_1 RIGHT OUTER JOIN
|
|
dbo.Person RIGHT OUTER JOIN
|
|
dbo.ApplikationLogbuch INNER JOIN
|
|
dbo.ReleaseArt ON dbo.ApplikationLogbuch.Releaseartnr = dbo.ReleaseArt.Releaseartnr LEFT OUTER JOIN
|
|
dbo.Person AS Person_2 ON dbo.ApplikationLogbuch.Freigabedurch = Person_2.PersonNr ON dbo.Person.PersonNr = dbo.ApplikationLogbuch.AbnahmeTecPerson ON
|
|
Person_1.PersonNr = dbo.ApplikationLogbuch.AbnahmeFBPerson
|
|
WHERE dbo.ApplikationLogbuch.ApplikationNr = @keyvalue
|
|
ORDER BY
|
|
[Releasedatum] desc
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationSLMTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationSLMTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationSLMTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationSLMTyp_Delete]
|
|
@iApplikationSLMTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationSLMTyp]
|
|
WHERE
|
|
[ApplikationSLMTypNr] = @iApplikationSLMTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationSLMTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationSLMTyp'
|
|
-- Gets: @iApplikationSLMTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationSLMTyp_Insert]
|
|
@iApplikationSLMTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@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].[ApplikationSLMTyp]
|
|
(
|
|
[ApplikationSLMTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationSLMTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationSLMTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationSLMTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationSLMTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationSLMTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationSLMTyp]
|
|
ORDER BY
|
|
[ApplikationSLMTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationSLMTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationSLMTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationSLMTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationSLMTyp_SelectOne]
|
|
@iApplikationSLMTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationSLMTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationSLMTyp]
|
|
WHERE
|
|
[ApplikationSLMTypNr] = @iApplikationSLMTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationSLMTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationSLMTyp'
|
|
-- Gets: @iApplikationSLMTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationSLMTyp_Update]
|
|
@iApplikationSLMTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@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].[ApplikationSLMTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationSLMTypNr] = @iApplikationSLMTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationStandardTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationStandardTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationStandardTyp_Delete]
|
|
@iApplikationStandardTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationStandardTyp]
|
|
WHERE
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationStandardTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationStandardTyp'
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationStandardTyp_Insert]
|
|
@iApplikationStandardTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[ApplikationStandardTyp]
|
|
(
|
|
[ApplikationStandardTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationStandardTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationStandardTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationStandardTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationStandardTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationStandardTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationStandardTyp]
|
|
ORDER BY
|
|
[ApplikationStandardTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationStandardTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationStandardTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationStandardTyp_SelectOne]
|
|
@iApplikationStandardTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationStandardTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationStandardTyp]
|
|
WHERE
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationStandardTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationStandardTyp'
|
|
-- Gets: @iApplikationStandardTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationStandardTyp_Update]
|
|
@iApplikationStandardTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[ApplikationStandardTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationStandardTypNr] = @iApplikationStandardTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTeam_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationTeam'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationTeamNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTeam_Delete]
|
|
@iApplikationTeamNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationTeam]
|
|
WHERE
|
|
[ApplikationTeamNr] = @iApplikationTeamNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTeam_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationTeam'
|
|
-- Gets: @iApplikationTeamNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTeam_Insert]
|
|
@iApplikationTeamNr int,
|
|
@sBezeichnung varchar(50),
|
|
@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].[ApplikationTeam]
|
|
(
|
|
[ApplikationTeamNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationTeamNr,
|
|
@sBezeichnung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTeam_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationTeam'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTeam_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationTeamNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationTeam]
|
|
ORDER BY
|
|
[ApplikationTeamNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTeam_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationTeam'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationTeamNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTeam_SelectOne]
|
|
@iApplikationTeamNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationTeamNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationTeam]
|
|
WHERE
|
|
[ApplikationTeamNr] = @iApplikationTeamNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTeam_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationTeam'
|
|
-- Gets: @iApplikationTeamNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTeam_Update]
|
|
@iApplikationTeamNr int,
|
|
@sBezeichnung varchar(50),
|
|
@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].[ApplikationTeam]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationTeamNr] = @iApplikationTeamNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTestAZ_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationTestAZ'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationTestAZnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTestAZ_Delete]
|
|
@iApplikationTestAZnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationTestAZ]
|
|
WHERE
|
|
[ApplikationTestAZnr] = @iApplikationTestAZnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTestAZ_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationTestAZ'
|
|
-- Gets: @iApplikationTestAZnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTestAZ_Insert]
|
|
@iApplikationTestAZnr int,
|
|
@sBezeichnung varchar(50),
|
|
@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].[ApplikationTestAZ]
|
|
(
|
|
[ApplikationTestAZnr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationTestAZnr,
|
|
@sBezeichnung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTestAZ_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationTestAZ'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTestAZ_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationTestAZnr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationTestAZ]
|
|
ORDER BY
|
|
[ApplikationTestAZnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTestAZ_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationTestAZ'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationTestAZnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTestAZ_SelectOne]
|
|
@iApplikationTestAZnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationTestAZnr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationTestAZ]
|
|
WHERE
|
|
[ApplikationTestAZnr] = @iApplikationTestAZnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationTestAZ_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationTestAZ'
|
|
-- Gets: @iApplikationTestAZnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationTestAZ_Update]
|
|
@iApplikationTestAZnr int,
|
|
@sBezeichnung varchar(50),
|
|
@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].[ApplikationTestAZ]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationTestAZnr] = @iApplikationTestAZnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVerantwortung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationVerantwortung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationVerantwortungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVerantwortung_Delete]
|
|
@iApplikationVerantwortungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationVerantwortung]
|
|
WHERE
|
|
[ApplikationVerantwortungNr] = @iApplikationVerantwortungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVerantwortung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationVerantwortung'
|
|
-- Gets: @iApplikationVerantwortungNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVerantwortung_Insert]
|
|
@iApplikationVerantwortungNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@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].[ApplikationVerantwortung]
|
|
(
|
|
[ApplikationVerantwortungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationVerantwortungNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVerantwortung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationVerantwortung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVerantwortung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationVerantwortungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationVerantwortung]
|
|
ORDER BY
|
|
[ApplikationVerantwortungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVerantwortung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationVerantwortung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationVerantwortungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVerantwortung_SelectOne]
|
|
@iApplikationVerantwortungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationVerantwortungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ApplikationVerantwortung]
|
|
WHERE
|
|
[ApplikationVerantwortungNr] = @iApplikationVerantwortungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVerantwortung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationVerantwortung'
|
|
-- Gets: @iApplikationVerantwortungNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVerantwortung_Update]
|
|
@iApplikationVerantwortungNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@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].[ApplikationVerantwortung]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ApplikationVerantwortungNr] = @iApplikationVerantwortungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVersion_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ApplikationVersion'
|
|
-- using the Primary Key.
|
|
-- Gets: @iApplikationVersionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVersion_Delete]
|
|
@iApplikationVersionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ApplikationVersion]
|
|
WHERE
|
|
[ApplikationVersionNr] = @iApplikationVersionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVersion_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ApplikationVersion'
|
|
-- Gets: @iApplikationVersionNr int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @sVersion varchar(255)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bEingesetzt bit
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVersion_Insert]
|
|
@iApplikationVersionNr int,
|
|
@iApplikationNr int,
|
|
@sVersion varchar(255),
|
|
@sBemerkung varchar(255),
|
|
@bEingesetzt bit,
|
|
@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].[ApplikationVersion]
|
|
(
|
|
[ApplikationVersionNr],
|
|
[ApplikationNr],
|
|
[Version],
|
|
[Bemerkung],
|
|
[Eingesetzt],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iApplikationVersionNr,
|
|
@iApplikationNr,
|
|
@sVersion,
|
|
@sBemerkung,
|
|
@bEingesetzt,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVersion_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ApplikationVersion'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVersion_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationVersionNr],
|
|
[ApplikationNr],
|
|
[Version],
|
|
[Bemerkung],
|
|
[Eingesetzt],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[ApplikationVersion]
|
|
ORDER BY
|
|
[ApplikationVersionNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVersion_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationabhaengigkeit'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_ApplikationVersion_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationVersionNr],
|
|
[ApplikationNr],
|
|
[Version],
|
|
[Bemerkung],
|
|
[Eingesetzt],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[ApplikationVersion]
|
|
where dbo.applikationversion.[ApplikationNr]=@keyvalue
|
|
--and dbo.Applikationabhaengigkeit.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
ORDER BY
|
|
[ApplikationVersionNr] ASC
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVersion_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ApplikationVersion'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iApplikationVersionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVersion_SelectOne]
|
|
@iApplikationVersionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ApplikationVersionNr],
|
|
[ApplikationNr],
|
|
[Version],
|
|
[Bemerkung],
|
|
[Eingesetzt],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[ApplikationVersion]
|
|
WHERE
|
|
[ApplikationVersionNr] = @iApplikationVersionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVersion_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ApplikationVersion'
|
|
-- Gets: @iApplikationVersionNr int
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @sVersion varchar(255)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bEingesetzt bit
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ApplikationVersion_Update]
|
|
@iApplikationVersionNr int,
|
|
@iApplikationNr int,
|
|
@sVersion varchar(255),
|
|
@sBemerkung varchar(255),
|
|
@bEingesetzt bit,
|
|
@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].[ApplikationVersion]
|
|
SET
|
|
[ApplikationNr] = @iApplikationNr,
|
|
[Version] = @sVersion,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Eingesetzt] = @bEingesetzt,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer
|
|
WHERE
|
|
[ApplikationVersionNr] = @iApplikationVersionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ApplikationVrsion_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Applikationabhaengigkeit'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_ApplikationVrsion_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ApplikationVersionNr],
|
|
[ApplikationNr],
|
|
[Version],
|
|
[Bemerkung],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[ApplikationVersion]
|
|
where dbo.applikationversion.[ApplikationNr]=@keyvalue
|
|
--and dbo.Applikationabhaengigkeit.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
ORDER BY
|
|
[ApplikationVersionNr] ASC
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Auswertung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iAuswertungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertung_Delete]
|
|
@iAuswertungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Auswertung]
|
|
WHERE
|
|
[AuswertungNr] = @iAuswertungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Auswertung'
|
|
-- Gets: @iAuswertungNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bCR_Report bit
|
|
-- Gets: @sCR_Filename varchar(255)
|
|
-- Gets: @bCSV_Report bit
|
|
-- Gets: @sSQL varchar(1024)
|
|
-- Gets: @bTXP_Auswertung bit
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @sConnectionstring_Subreport varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertung_Insert]
|
|
@iAuswertungNr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bCR_Report bit,
|
|
@sCR_Filename varchar(255),
|
|
@bCSV_Report bit,
|
|
@sSQL varchar(1024),
|
|
@bTXP_Auswertung bit,
|
|
@sBeschreibung varchar(1024),
|
|
@sConnectionstring_Subreport varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Auswertung]
|
|
(
|
|
[AuswertungNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[CR_Report],
|
|
[CR_Filename],
|
|
[CSV_Report],
|
|
[SQL],
|
|
[TXP_Auswertung],
|
|
[Beschreibung],
|
|
[Connectionstring_Subreport]
|
|
)
|
|
VALUES
|
|
(
|
|
@iAuswertungNr,
|
|
@sBezeichnung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bCR_Report,
|
|
@sCR_Filename,
|
|
@bCSV_Report,
|
|
@sSQL,
|
|
@bTXP_Auswertung,
|
|
@sBeschreibung,
|
|
@sConnectionstring_Subreport
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Auswertung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[AuswertungNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[CR_Report],
|
|
[CR_Filename],
|
|
[CSV_Report],
|
|
[SQL],
|
|
[TXP_Auswertung],
|
|
[Beschreibung],
|
|
[Connectionstring_Subreport]
|
|
FROM [dbo].[Auswertung]
|
|
ORDER BY
|
|
[AuswertungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Auswertung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iAuswertungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertung_SelectOne]
|
|
@iAuswertungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[AuswertungNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[CR_Report],
|
|
[CR_Filename],
|
|
[CSV_Report],
|
|
[SQL],
|
|
[TXP_Auswertung],
|
|
[Beschreibung],
|
|
[Connectionstring_Subreport]
|
|
FROM [dbo].[Auswertung]
|
|
WHERE
|
|
[AuswertungNr] = @iAuswertungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Auswertung'
|
|
-- Gets: @iAuswertungNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bCR_Report bit
|
|
-- Gets: @sCR_Filename varchar(255)
|
|
-- Gets: @bCSV_Report bit
|
|
-- Gets: @sSQL varchar(1024)
|
|
-- Gets: @bTXP_Auswertung bit
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @sConnectionstring_Subreport varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertung_Update]
|
|
@iAuswertungNr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bCR_Report bit,
|
|
@sCR_Filename varchar(255),
|
|
@bCSV_Report bit,
|
|
@sSQL varchar(1024),
|
|
@bTXP_Auswertung bit,
|
|
@sBeschreibung varchar(1024),
|
|
@sConnectionstring_Subreport varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Auswertung]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[CR_Report] = @bCR_Report,
|
|
[CR_Filename] = @sCR_Filename,
|
|
[CSV_Report] = @bCSV_Report,
|
|
[SQL] = @sSQL,
|
|
[TXP_Auswertung] = @bTXP_Auswertung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Connectionstring_Subreport] = @sConnectionstring_Subreport
|
|
WHERE
|
|
[AuswertungNr] = @iAuswertungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungAuswertungParameter_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'AuswertungAuswertungParameter'
|
|
-- using the Primary Key.
|
|
-- Gets: @iAuswertungAuswertungparameternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungAuswertungParameter_Delete]
|
|
@iAuswertungAuswertungparameternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[AuswertungAuswertungParameter]
|
|
WHERE
|
|
[AuswertungAuswertungparameternr] = @iAuswertungAuswertungparameternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungAuswertungParameter_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'AuswertungAuswertungParameter'
|
|
-- Gets: @iAuswertungAuswertungparameternr int
|
|
-- Gets: @iAuswertungnr int
|
|
-- Gets: @iAuswertungparameternr int
|
|
-- Gets: @sDBfeldname varchar(255)
|
|
-- Gets: @iReihenfolge int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungAuswertungParameter_Insert]
|
|
@iAuswertungAuswertungparameternr int,
|
|
@iAuswertungnr int,
|
|
@iAuswertungparameternr int,
|
|
@sDBfeldname varchar(255),
|
|
@iReihenfolge 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].[AuswertungAuswertungParameter]
|
|
(
|
|
[AuswertungAuswertungparameternr],
|
|
[Auswertungnr],
|
|
[Auswertungparameternr],
|
|
[DBfeldname],
|
|
[Reihenfolge],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iAuswertungAuswertungparameternr,
|
|
@iAuswertungnr,
|
|
@iAuswertungparameternr,
|
|
@sDBfeldname,
|
|
@iReihenfolge,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungAuswertungParameter_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'AuswertungAuswertungParameter'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungAuswertungParameter_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[AuswertungAuswertungparameternr],
|
|
[Auswertungnr],
|
|
[Auswertungparameternr],
|
|
[DBfeldname],
|
|
[Reihenfolge],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[AuswertungAuswertungParameter]
|
|
ORDER BY
|
|
[AuswertungAuswertungparameternr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungAuswertungParameter_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungAuswertungParameter_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.AuswertungAuswertungParameter.AuswertungAuswertungparameternr, dbo.AuswertungAuswertungParameter.Auswertungnr,
|
|
dbo.Auswertung.Bezeichnung AS Auswertung, dbo.AuswertungAuswertungParameter.Auswertungparameternr, dbo.Auswertungsparameter.Bezeichnung AS Parameter,
|
|
dbo.AuswertungAuswertungParameter.DBfeldname, dbo.AuswertungAuswertungParameter.Reihenfolge,
|
|
dbo.AuswertungAuswertungParameter.Aktiv, dbo.AuswertungAuswertungParameter.Erstellt_am, dbo.AuswertungAuswertungParameter.Mutiert_am,
|
|
dbo.AuswertungAuswertungParameter.Mutierer
|
|
FROM dbo.Auswertungsparameter INNER JOIN
|
|
dbo.AuswertungAuswertungParameter ON
|
|
dbo.Auswertungsparameter.Auswertungparameternr = dbo.AuswertungAuswertungParameter.Auswertungparameternr INNER JOIN
|
|
dbo.Auswertung ON dbo.AuswertungAuswertungParameter.Auswertungnr = dbo.Auswertung.AuswertungNr
|
|
where auswertungauswertungparameter.auswertungnr=@keyvalue
|
|
ORDER BY dbo.auswertungauswertungparameter.auswertungauswertungparameternr
|
|
end else begin
|
|
SELECT dbo.AuswertungAuswertungParameter.AuswertungAuswertungparameternr, dbo.AuswertungAuswertungParameter.Auswertungnr,
|
|
dbo.Auswertung.Bezeichnung AS Auswertung, dbo.AuswertungAuswertungParameter.Auswertungparameternr, dbo.Auswertungsparameter.Bezeichnung AS Parameter,
|
|
dbo.AuswertungAuswertungParameter.DBfeldname,dbo.AuswertungAuswertungParameter.Reihenfolge,
|
|
dbo.AuswertungAuswertungParameter.Aktiv, dbo.AuswertungAuswertungParameter.Erstellt_am, dbo.AuswertungAuswertungParameter.Mutiert_am,
|
|
dbo.AuswertungAuswertungParameter.Mutierer
|
|
FROM dbo.Auswertungsparameter INNER JOIN
|
|
dbo.AuswertungAuswertungParameter ON
|
|
dbo.Auswertungsparameter.Auswertungparameternr = dbo.AuswertungAuswertungParameter.Auswertungparameternr INNER JOIN
|
|
dbo.Auswertung ON dbo.AuswertungAuswertungParameter.Auswertungnr = dbo.Auswertung.AuswertungNr
|
|
where auswertungauswertungparameter.auswertungparameternr=@keyvalue
|
|
ORDER BY dbo.auswertungauswertungparameter.auswertungauswertungparameternr
|
|
|
|
end
|
|
-- SELECT all rows from the table.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
/****** Objekt: StoredProcedure [dbo].[pr_rfcboard_mitarbeiter_SelectAll_Bottomtable] Skriptdatum: 03/31/2009 16:59:11 ******/
|
|
SET ANSI_NULLS OFF
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungAuswertungParameter_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'AuswertungAuswertungParameter'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iAuswertungAuswertungparameternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungAuswertungParameter_SelectOne]
|
|
@iAuswertungAuswertungparameternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[AuswertungAuswertungparameternr],
|
|
[Auswertungnr],
|
|
[Auswertungparameternr],
|
|
[DBfeldname],
|
|
[Reihenfolge],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[AuswertungAuswertungParameter]
|
|
WHERE
|
|
[AuswertungAuswertungparameternr] = @iAuswertungAuswertungparameternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungAuswertungParameter_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'AuswertungAuswertungParameter'
|
|
-- Gets: @iAuswertungAuswertungparameternr int
|
|
-- Gets: @iAuswertungnr int
|
|
-- Gets: @iAuswertungparameternr int
|
|
-- Gets: @sDBfeldname varchar(255)
|
|
-- Gets: @iReihenfolge int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungAuswertungParameter_Update]
|
|
@iAuswertungAuswertungparameternr int,
|
|
@iAuswertungnr int,
|
|
@iAuswertungparameternr int,
|
|
@sDBfeldname varchar(255),
|
|
@iReihenfolge 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].[AuswertungAuswertungParameter]
|
|
SET
|
|
[Auswertungnr] = @iAuswertungnr,
|
|
[Auswertungparameternr] = @iAuswertungparameternr,
|
|
[DBfeldname] = @sDBfeldname,
|
|
[Reihenfolge] = @iReihenfolge,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[AuswertungAuswertungparameternr] = @iAuswertungAuswertungparameternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppe_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'AuswertungGruppe'
|
|
-- using the Primary Key.
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppe_Delete]
|
|
@iAuswertungGruppeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[AuswertungGruppe]
|
|
WHERE
|
|
[AuswertungGruppeNr] = @iAuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppe_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'AuswertungGruppe'
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iParentid int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppe_Insert]
|
|
@iAuswertungGruppeNr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iParentid int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[AuswertungGruppe]
|
|
(
|
|
[AuswertungGruppeNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Parentid]
|
|
)
|
|
VALUES
|
|
(
|
|
@iAuswertungGruppeNr,
|
|
@sBezeichnung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iParentid
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppe_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'AuswertungGruppe'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppe_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[AuswertungGruppeNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Parentid]
|
|
FROM [dbo].[AuswertungGruppe]
|
|
ORDER BY
|
|
[AuswertungGruppeNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppe_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'AuswertungGruppe'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppe_SelectOne]
|
|
@iAuswertungGruppeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[AuswertungGruppeNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Parentid]
|
|
FROM [dbo].[AuswertungGruppe]
|
|
WHERE
|
|
[AuswertungGruppeNr] = @iAuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppe_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'AuswertungGruppe'
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iParentid int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppe_Update]
|
|
@iAuswertungGruppeNr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iParentid int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[AuswertungGruppe]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Parentid] = @iParentid
|
|
WHERE
|
|
[AuswertungGruppeNr] = @iAuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppeAuswertung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'AuswertungGruppeAuswertung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iAuswertungGruppeAuswertungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppeAuswertung_Delete]
|
|
@iAuswertungGruppeAuswertungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[AuswertungGruppeAuswertung]
|
|
WHERE
|
|
[AuswertungGruppeAuswertungNr] = @iAuswertungGruppeAuswertungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppeAuswertung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'AuswertungGruppeAuswertung'
|
|
-- Gets: @iAuswertungGruppeAuswertungNr int
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @iAuswertungNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstllt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppeAuswertung_Insert]
|
|
@iAuswertungGruppeAuswertungNr int,
|
|
@iAuswertungGruppeNr int,
|
|
@iAuswertungNr int,
|
|
@bAktiv bit,
|
|
@daErstllt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[AuswertungGruppeAuswertung]
|
|
(
|
|
[AuswertungGruppeAuswertungNr],
|
|
[AuswertungGruppeNr],
|
|
[AuswertungNr],
|
|
[Aktiv],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iAuswertungGruppeAuswertungNr,
|
|
@iAuswertungGruppeNr,
|
|
@iAuswertungNr,
|
|
@bAktiv,
|
|
@daErstllt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppeAuswertung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'AuswertungGruppeAuswertung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppeAuswertung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[AuswertungGruppeAuswertungNr],
|
|
[AuswertungGruppeNr],
|
|
[AuswertungNr],
|
|
[Aktiv],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[AuswertungGruppeAuswertung]
|
|
ORDER BY
|
|
[AuswertungGruppeAuswertungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppeAuswertung_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_AuswertungGruppeAuswertung_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.AuswertungGruppeAuswertung.AuswertungGruppeAuswertungNr, dbo.AuswertungGruppeAuswertung.AuswertungGruppeNr,
|
|
dbo.AuswertungGruppe.Bezeichnung AS Gruppe, dbo.AuswertungGruppeAuswertung.AuswertungNr, dbo.Auswertung.Bezeichnung AS Auswertung,
|
|
dbo.AuswertungGruppeAuswertung.Aktiv, dbo.AuswertungGruppeAuswertung.Erstllt_am, dbo.AuswertungGruppeAuswertung.Mutiert_am,
|
|
dbo.AuswertungGruppeAuswertung.Mutierer
|
|
FROM dbo.AuswertungGruppeAuswertung INNER JOIN
|
|
dbo.AuswertungGruppe ON dbo.AuswertungGruppeAuswertung.AuswertungGruppeNr = dbo.AuswertungGruppe.AuswertungGruppeNr INNER JOIN
|
|
dbo.Auswertung ON dbo.AuswertungGruppeAuswertung.AuswertungNr = dbo.Auswertung.AuswertungNr
|
|
where auswertunggruppeauswertung.auswertunggruppenr=@keyvalue
|
|
ORDER BY dbo.auswertunggruppeauswertung.auswertunggruppenr
|
|
end else begin
|
|
SELECT dbo.AuswertungGruppeAuswertung.AuswertungGruppeAuswertungNr, dbo.AuswertungGruppeAuswertung.AuswertungGruppeNr,
|
|
dbo.AuswertungGruppe.Bezeichnung AS Gruppe, dbo.AuswertungGruppeAuswertung.AuswertungNr, dbo.Auswertung.Bezeichnung AS Auswertung,
|
|
dbo.AuswertungGruppeAuswertung.Aktiv, dbo.AuswertungGruppeAuswertung.Erstllt_am, dbo.AuswertungGruppeAuswertung.Mutiert_am,
|
|
dbo.AuswertungGruppeAuswertung.Mutierer
|
|
FROM dbo.AuswertungGruppeAuswertung INNER JOIN
|
|
dbo.AuswertungGruppe ON dbo.AuswertungGruppeAuswertung.AuswertungGruppeNr = dbo.AuswertungGruppe.AuswertungGruppeNr INNER JOIN
|
|
dbo.Auswertung ON dbo.AuswertungGruppeAuswertung.AuswertungNr = dbo.Auswertung.AuswertungNr
|
|
where auswertunggruppeauswertung.auswertungnr=@keyvalue
|
|
ORDER BY dbo.auswertunggruppeauswertung.auswertunggruppenr
|
|
|
|
end
|
|
-- SELECT all rows from the table.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppeAuswertung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'AuswertungGruppeAuswertung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iAuswertungGruppeAuswertungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppeAuswertung_SelectOne]
|
|
@iAuswertungGruppeAuswertungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[AuswertungGruppeAuswertungNr],
|
|
[AuswertungGruppeNr],
|
|
[AuswertungNr],
|
|
[Aktiv],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[AuswertungGruppeAuswertung]
|
|
WHERE
|
|
[AuswertungGruppeAuswertungNr] = @iAuswertungGruppeAuswertungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_AuswertungGruppeAuswertung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'AuswertungGruppeAuswertung'
|
|
-- Gets: @iAuswertungGruppeAuswertungNr int
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @iAuswertungNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstllt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_AuswertungGruppeAuswertung_Update]
|
|
@iAuswertungGruppeAuswertungNr int,
|
|
@iAuswertungGruppeNr int,
|
|
@iAuswertungNr int,
|
|
@bAktiv bit,
|
|
@daErstllt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[AuswertungGruppeAuswertung]
|
|
SET
|
|
[AuswertungGruppeNr] = @iAuswertungGruppeNr,
|
|
[AuswertungNr] = @iAuswertungNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstllt_am] = @daErstllt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[AuswertungGruppeAuswertungNr] = @iAuswertungGruppeAuswertungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertungsparameter_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Auswertungsparameter'
|
|
-- using the Primary Key.
|
|
-- Gets: @iAuswertungparameternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertungsparameter_Delete]
|
|
@iAuswertungparameternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Auswertungsparameter]
|
|
WHERE
|
|
[Auswertungparameternr] = @iAuswertungparameternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertungsparameter_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Auswertungsparameter'
|
|
-- Gets: @iAuswertungparameternr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sOperator varchar(50)
|
|
-- Gets: @sFeldbezug varchar(200)
|
|
-- Gets: @sWert varchar(50)
|
|
-- Gets: @sParamName varchar(50)
|
|
-- Gets: @sParamType varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bFix bit
|
|
-- Gets: @sFixOperator varchar(255)
|
|
-- Gets: @bVisible bit
|
|
-- Gets: @sDefaultvalue varchar(255)
|
|
-- Gets: @bEditable bit
|
|
-- Gets: @sParam_Name varchar(50)
|
|
-- Gets: @sFixAndOr varchar(50)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertungsparameter_Insert]
|
|
@iAuswertungparameternr int,
|
|
@sBezeichnung varchar(50),
|
|
@sOperator varchar(50),
|
|
@sFeldbezug varchar(200),
|
|
@sWert varchar(50),
|
|
@sParamName varchar(50),
|
|
@sParamType varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bFix bit,
|
|
@sFixOperator varchar(255),
|
|
@bVisible bit,
|
|
@sDefaultvalue varchar(255),
|
|
@bEditable bit,
|
|
@sParam_Name varchar(50),
|
|
@sFixAndOr varchar(50),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Auswertungsparameter]
|
|
(
|
|
[Auswertungparameternr],
|
|
[Bezeichnung],
|
|
[Operator],
|
|
[Feldbezug],
|
|
[Wert],
|
|
[ParamName],
|
|
[ParamType],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Fix],
|
|
[FixOperator],
|
|
[Visible],
|
|
[Defaultvalue],
|
|
[Editable],
|
|
[Param_Name],
|
|
[FixAndOr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iAuswertungparameternr,
|
|
@sBezeichnung,
|
|
@sOperator,
|
|
@sFeldbezug,
|
|
@sWert,
|
|
@sParamName,
|
|
@sParamType,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bFix,
|
|
@sFixOperator,
|
|
@bVisible,
|
|
@sDefaultvalue,
|
|
@bEditable,
|
|
@sParam_Name,
|
|
@sFixAndOr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertungsparameter_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Auswertungsparameter'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertungsparameter_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Auswertungparameternr],
|
|
[Bezeichnung],
|
|
[Operator],
|
|
[Feldbezug],
|
|
[Wert],
|
|
[ParamName],
|
|
[ParamType],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Fix],
|
|
[FixOperator],
|
|
[Visible],
|
|
[Defaultvalue],
|
|
[Editable],
|
|
[Param_Name],
|
|
[FixAndOr]
|
|
FROM [dbo].[Auswertungsparameter]
|
|
ORDER BY
|
|
[Auswertungparameternr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertungsparameter_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Auswertungsparameter'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iAuswertungparameternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertungsparameter_SelectOne]
|
|
@iAuswertungparameternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Auswertungparameternr],
|
|
[Bezeichnung],
|
|
[Operator],
|
|
[Feldbezug],
|
|
[Wert],
|
|
[ParamName],
|
|
[ParamType],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Fix],
|
|
[FixOperator],
|
|
[Visible],
|
|
[Defaultvalue],
|
|
[Editable],
|
|
[Param_Name],
|
|
[FixAndOr]
|
|
FROM [dbo].[Auswertungsparameter]
|
|
WHERE
|
|
[Auswertungparameternr] = @iAuswertungparameternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Auswertungsparameter_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Auswertungsparameter'
|
|
-- Gets: @iAuswertungparameternr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sOperator varchar(50)
|
|
-- Gets: @sFeldbezug varchar(200)
|
|
-- Gets: @sWert varchar(50)
|
|
-- Gets: @sParamName varchar(50)
|
|
-- Gets: @sParamType varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bFix bit
|
|
-- Gets: @sFixOperator varchar(255)
|
|
-- Gets: @bVisible bit
|
|
-- Gets: @sDefaultvalue varchar(255)
|
|
-- Gets: @bEditable bit
|
|
-- Gets: @sParam_Name varchar(50)
|
|
-- Gets: @sFixAndOr varchar(50)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Auswertungsparameter_Update]
|
|
@iAuswertungparameternr int,
|
|
@sBezeichnung varchar(50),
|
|
@sOperator varchar(50),
|
|
@sFeldbezug varchar(200),
|
|
@sWert varchar(50),
|
|
@sParamName varchar(50),
|
|
@sParamType varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bFix bit,
|
|
@sFixOperator varchar(255),
|
|
@bVisible bit,
|
|
@sDefaultvalue varchar(255),
|
|
@bEditable bit,
|
|
@sParam_Name varchar(50),
|
|
@sFixAndOr varchar(50),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Auswertungsparameter]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Operator] = @sOperator,
|
|
[Feldbezug] = @sFeldbezug,
|
|
[Wert] = @sWert,
|
|
[ParamName] = @sParamName,
|
|
[ParamType] = @sParamType,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Fix] = @bFix,
|
|
[FixOperator] = @sFixOperator,
|
|
[Visible] = @bVisible,
|
|
[Defaultvalue] = @sDefaultvalue,
|
|
[Editable] = @bEditable,
|
|
[Param_Name] = @sParam_Name,
|
|
[FixAndOr] = @sFixAndOr
|
|
WHERE
|
|
[Auswertungparameternr] = @iAuswertungparameternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Beziehungstyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Beziehungstyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iBeziehungstypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Beziehungstyp_Delete]
|
|
@iBeziehungstypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Beziehungstyp]
|
|
WHERE
|
|
[BeziehungstypNr] = @iBeziehungstypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Beziehungstyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Beziehungstyp'
|
|
-- Gets: @iBeziehungstypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBezeichnung2 varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Beziehungstyp_Insert]
|
|
@iBeziehungstypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBezeichnung2 varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Beziehungstyp]
|
|
(
|
|
[BeziehungstypNr],
|
|
[Bezeichnung],
|
|
[Bezeichnung2],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iBeziehungstypNr,
|
|
@sBezeichnung,
|
|
@sBezeichnung2,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Beziehungstyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Beziehungstyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Beziehungstyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[BeziehungstypNr],
|
|
[Bezeichnung],
|
|
[Bezeichnung2],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[Beziehungstyp]
|
|
ORDER BY
|
|
[BeziehungstypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Beziehungstyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Beziehungstyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iBeziehungstypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Beziehungstyp_SelectOne]
|
|
@iBeziehungstypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[BeziehungstypNr],
|
|
[Bezeichnung],
|
|
[Bezeichnung2],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[Beziehungstyp]
|
|
WHERE
|
|
[BeziehungstypNr] = @iBeziehungstypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Beziehungstyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Beziehungstyp'
|
|
-- Gets: @iBeziehungstypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBezeichnung2 varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Beziehungstyp_Update]
|
|
@iBeziehungstypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBezeichnung2 varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Beziehungstyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Bezeichnung2] = @sBezeichnung2,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr
|
|
WHERE
|
|
[BeziehungstypNr] = @iBeziehungstypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokument_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Dokument'
|
|
-- using the Primary Key.
|
|
-- Gets: @iDokumentNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Dokument_Delete]
|
|
@iDokumentNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Dokument]
|
|
WHERE
|
|
[DokumentNr] = @iDokumentNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokument_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Dokument'
|
|
-- Gets: @iDokumentNr int
|
|
-- Gets: @iKeyValue int
|
|
-- Gets: @iDokType int
|
|
-- Gets: @iDokumenttypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- 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_Dokument_Insert]
|
|
@iDokumentNr int,
|
|
@iKeyValue int,
|
|
@iDokType int,
|
|
@iDokumenttypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(1024),
|
|
@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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokument_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Dokument'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[Dokument]
|
|
ORDER BY
|
|
[DokumentNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_dokument_selectall_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[pr_dokument_selectall_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SELECT 0 as DokIcon, dbo.Dokument.DokumentNr, dbo.Dokument.keyvalue as VertragselementNr, dbo.Dokumenttyp.Bezeichnung as Dokumenttyp, dbo.Dokument.Bezeichnung AS Bezeichnung, dbo.Dokument.Beschreibung,
|
|
dbo.Dokument.Filename, dbo.Dokument.OriginalFilename_incl_Path, dbo.Dokument.Version, dbo.Dokument.VersionsNr, dbo.Dokument.Versionsdatum,
|
|
dbo.Dokument.Erstellt_am, dbo.Dokument.Mutiert_am, dbo.Dokument.Mutierer, dbo.Dokument.Aktiv, dbo.Dokument.SecurityLevelNr
|
|
FROM dbo.Dokument INNER JOIN
|
|
dbo.Dokumenttyp ON dbo.Dokument.DokumenttypNr = dbo.Dokumenttyp.Dokumenttypnr
|
|
where dbo.dokument.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and keyvalue = @keyvalue and doktype=1
|
|
order by dbo.dokument.erstellt_am desc
|
|
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
RETURN
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokument_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Dokument'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iDokumentNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[Dokument]
|
|
WHERE
|
|
[DokumentNr] = @iDokumentNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokument_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Dokument'
|
|
-- Gets: @iDokumentNr int
|
|
-- Gets: @iKeyValue int
|
|
-- Gets: @iDokType int
|
|
-- Gets: @iDokumenttypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- 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_Dokument_Update]
|
|
@iDokumentNr int,
|
|
@iKeyValue int,
|
|
@iDokType int,
|
|
@iDokumenttypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(1024),
|
|
@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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageort_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'DokumentAblageort'
|
|
-- using the Primary Key.
|
|
-- Gets: @iDokumentablageortNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_DokumentAblageort_Delete]
|
|
@iDokumentablageortNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[DokumentAblageort]
|
|
WHERE
|
|
[DokumentablageortNr] = @iDokumentablageortNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageort_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table '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_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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageort_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'DokumentAblageort'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[DokumentAblageort]
|
|
ORDER BY
|
|
[DokumentablageortNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageort_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'DokumentAblageort'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_DokumentAblageort_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
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].[DokumentAblageort]
|
|
Where dokumentnr=@keyvalue
|
|
ORDER BY
|
|
[DokumentablageortNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageort_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'DokumentAblageort'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iDokumentablageortNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[DokumentAblageort]
|
|
WHERE
|
|
[DokumentablageortNr] = @iDokumentablageortNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageort_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table '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_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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'DokumentAblageTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iDokumentAblageTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_DokumentAblageTyp_Delete]
|
|
@iDokumentAblageTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[DokumentAblageTyp]
|
|
WHERE
|
|
[DokumentAblageTypNr] = @iDokumentAblageTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table '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_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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'DokumentAblageTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[DokumentAblageTyp]
|
|
ORDER BY
|
|
[DokumentAblageTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'DokumentAblageTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iDokumentAblageTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[DokumentAblageTyp]
|
|
WHERE
|
|
[DokumentAblageTypNr] = @iDokumentAblageTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_DokumentAblageTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table '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_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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokumenttyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Dokumenttyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iDokumenttypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Dokumenttyp_Delete]
|
|
@iDokumenttypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Dokumenttyp]
|
|
WHERE
|
|
[Dokumenttypnr] = @iDokumenttypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokumenttyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table '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_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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokumenttyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Dokumenttyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[Dokumenttyp]
|
|
ORDER BY
|
|
[Dokumenttypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokumenttyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Dokumenttyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iDokumenttypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_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].[Dokumenttyp]
|
|
WHERE
|
|
[Dokumenttypnr] = @iDokumenttypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Dokumenttyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table '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_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].[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
|
|
/****** Object: StoredProcedure [dbo].[pr_Ereignistyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Ereignistyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iEreignistypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Ereignistyp_Delete]
|
|
@iEreignistypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Ereignistyp]
|
|
WHERE
|
|
[Ereignistypnr] = @iEreignistypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Ereignistyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Ereignistyp'
|
|
-- Gets: @iEreignistypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktivitaeten_generieren bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @bKuendigung bit
|
|
-- Gets: @bZahlung bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Ereignistyp_Insert]
|
|
@iEreignistypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktivitaeten_generieren bit,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@bKuendigung bit,
|
|
@bZahlung bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Ereignistyp]
|
|
(
|
|
[Ereignistypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktivitaeten_generieren],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Kuendigung],
|
|
[Zahlung]
|
|
)
|
|
VALUES
|
|
(
|
|
@iEreignistypnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktivitaeten_generieren,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@bKuendigung,
|
|
@bZahlung
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Ereignistyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Ereignistyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Ereignistyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Ereignistypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktivitaeten_generieren],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Kuendigung],
|
|
[Zahlung]
|
|
FROM [dbo].[Ereignistyp]
|
|
ORDER BY
|
|
[Ereignistypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Ereignistyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Ereignistyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iEreignistypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Ereignistyp_SelectOne]
|
|
@iEreignistypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Ereignistypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktivitaeten_generieren],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Kuendigung],
|
|
[Zahlung]
|
|
FROM [dbo].[Ereignistyp]
|
|
WHERE
|
|
[Ereignistypnr] = @iEreignistypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Ereignistyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Ereignistyp'
|
|
-- Gets: @iEreignistypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktivitaeten_generieren bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @bKuendigung bit
|
|
-- Gets: @bZahlung bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Ereignistyp_Update]
|
|
@iEreignistypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktivitaeten_generieren bit,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@bKuendigung bit,
|
|
@bZahlung bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Ereignistyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktivitaeten_generieren] = @bAktivitaeten_generieren,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[Kuendigung] = @bKuendigung,
|
|
[Zahlung] = @bZahlung
|
|
WHERE
|
|
[Ereignistypnr] = @iEreignistypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Faktoren_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Faktoren'
|
|
-- using the Primary Key.
|
|
-- Gets: @iEintragnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Faktoren_Delete]
|
|
@iEintragnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Faktoren]
|
|
WHERE
|
|
[Eintragnr] = @iEintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Faktoren_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Faktoren'
|
|
-- Gets: @iEintragnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @fFaktor_Prod_Tage float(53)
|
|
-- Gets: @fFuehrungsanteil float(53)
|
|
-- Gets: @bStandard bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Faktoren_Insert]
|
|
@iEintragnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@fFaktor_Prod_Tage float(53),
|
|
@fFuehrungsanteil float(53),
|
|
@bStandard bit,
|
|
@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].[Faktoren]
|
|
(
|
|
[Eintragnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Faktor_Prod_Tage],
|
|
[Fuehrungsanteil],
|
|
[Standard],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iEintragnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@fFaktor_Prod_Tage,
|
|
@fFuehrungsanteil,
|
|
@bStandard,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Faktoren_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Faktoren'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Faktoren_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Eintragnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Faktor_Prod_Tage],
|
|
[Fuehrungsanteil],
|
|
[Standard],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Faktoren]
|
|
ORDER BY
|
|
[Eintragnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Faktoren_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Faktoren'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iEintragnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Faktoren_SelectOne]
|
|
@iEintragnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Eintragnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Faktor_Prod_Tage],
|
|
[Fuehrungsanteil],
|
|
[Standard],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Faktoren]
|
|
WHERE
|
|
[Eintragnr] = @iEintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Faktoren_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Faktoren'
|
|
-- Gets: @iEintragnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @fFaktor_Prod_Tage float(53)
|
|
-- Gets: @fFuehrungsanteil float(53)
|
|
-- Gets: @bStandard bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Faktoren_Update]
|
|
@iEintragnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@fFaktor_Prod_Tage float(53),
|
|
@fFuehrungsanteil float(53),
|
|
@bStandard bit,
|
|
@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].[Faktoren]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Faktor_Prod_Tage] = @fFaktor_Prod_Tage,
|
|
[Fuehrungsanteil] = @fFuehrungsanteil,
|
|
[Standard] = @bStandard,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Eintragnr] = @iEintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Funktion_AuswertungGruppe_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Funktion_AuswertungGruppe'
|
|
-- using the Primary Key.
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Funktion_AuswertungGruppe_Delete]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Funktion_AuswertungGruppe]
|
|
WHERE
|
|
[Funktion_AuswertungGruppeNr] = @iFunktion_AuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Funktion_AuswertungGruppe_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Funktion_AuswertungGruppe'
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Gets: @iFunktionNr int
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Funktion_AuswertungGruppe_Insert]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@iFunktionNr int,
|
|
@iAuswertungGruppeNr 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].[Funktion_AuswertungGruppe]
|
|
(
|
|
[Funktion_AuswertungGruppeNr],
|
|
[FunktionNr],
|
|
[AuswertungGruppeNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iFunktion_AuswertungGruppeNr,
|
|
@iFunktionNr,
|
|
@iAuswertungGruppeNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Funktion_AuswertungGruppe_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Funktion_AuswertungGruppe'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Funktion_AuswertungGruppe_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Funktion_AuswertungGruppeNr],
|
|
[FunktionNr],
|
|
[AuswertungGruppeNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Funktion_AuswertungGruppe]
|
|
ORDER BY
|
|
[Funktion_AuswertungGruppeNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Funktion_AuswertungGruppe_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Funktion_AuswertungGruppe_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.Funktion_AuswertungGruppe.Funktion_AuswertungGruppeNr, dbo.Funktion_AuswertungGruppe.FunktionNr, dbo.funktionsgruppe.bezeichnung AS Funktion,
|
|
dbo.Funktion_AuswertungGruppe.AuswertungGruppeNr, dbo.AuswertungGruppe.Bezeichnung AS AuswertungGruppe, dbo.Funktion_AuswertungGruppe.Aktiv,
|
|
dbo.Funktion_AuswertungGruppe.Erstellt_am, dbo.Funktion_AuswertungGruppe.Mutiert_am, dbo.Funktion_AuswertungGruppe.Mutierer
|
|
FROM dbo.Funktion_AuswertungGruppe INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.Funktion_AuswertungGruppe.FunktionNr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.AuswertungGruppe ON dbo.Funktion_AuswertungGruppe.AuswertungGruppeNr = dbo.AuswertungGruppe.AuswertungGruppeNr
|
|
where funktion_auswertunggruppe.funktionnr=@keyvalue
|
|
ORDER BY dbo.Funktion_AuswertungGruppe.Funktion_AuswertungGruppeNr
|
|
end else begin
|
|
SELECT dbo.Funktion_AuswertungGruppe.Funktion_AuswertungGruppeNr, dbo.Funktion_AuswertungGruppe.FunktionNr, dbo.funktionsgruppe.bezeichnung AS Funktion,
|
|
dbo.Funktion_AuswertungGruppe.AuswertungGruppeNr, dbo.AuswertungGruppe.Bezeichnung AS AuswertungGruppe, dbo.Funktion_AuswertungGruppe.Aktiv,
|
|
dbo.Funktion_AuswertungGruppe.Erstellt_am, dbo.Funktion_AuswertungGruppe.Mutiert_am, dbo.Funktion_AuswertungGruppe.Mutierer
|
|
FROM dbo.Funktion_AuswertungGruppe INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.Funktion_AuswertungGruppe.FunktionNr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.AuswertungGruppe ON dbo.Funktion_AuswertungGruppe.AuswertungGruppeNr = dbo.AuswertungGruppe.AuswertungGruppeNr
|
|
where funktion_auswertunggruppe.AuswertungGruppeNr=@keyvalue
|
|
ORDER BY dbo.Funktion_AuswertungGruppe.Funktion_AuswertungGruppeNr
|
|
|
|
|
|
end
|
|
-- SELECT all rows from the table.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Funktion_AuswertungGruppe_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Funktion_AuswertungGruppe'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Funktion_AuswertungGruppe_SelectOne]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Funktion_AuswertungGruppeNr],
|
|
[FunktionNr],
|
|
[AuswertungGruppeNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Funktion_AuswertungGruppe]
|
|
WHERE
|
|
[Funktion_AuswertungGruppeNr] = @iFunktion_AuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Funktion_AuswertungGruppe_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Funktion_AuswertungGruppe'
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Gets: @iFunktionNr int
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Funktion_AuswertungGruppe_Update]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@iFunktionNr int,
|
|
@iAuswertungGruppeNr 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].[Funktion_AuswertungGruppe]
|
|
SET
|
|
[FunktionNr] = @iFunktionNr,
|
|
[AuswertungGruppeNr] = @iAuswertungGruppeNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Funktion_AuswertungGruppeNr] = @iFunktion_AuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_auswertungGruppe_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'funktionsgruppe_auswertungGruppe'
|
|
-- using the Primary Key.
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_auswertungGruppe_Delete]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[funktionsgruppe_auswertungGruppe]
|
|
WHERE
|
|
[Funktion_AuswertungGruppeNr] = @iFunktion_AuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_auswertungGruppe_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'funktionsgruppe_auswertungGruppe'
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_auswertungGruppe_Insert]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@ifunktionsgruppenr int,
|
|
@iAuswertungGruppeNr 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_auswertungGruppe]
|
|
(
|
|
[Funktion_AuswertungGruppeNr],
|
|
[funktionsgruppenr],
|
|
[AuswertungGruppeNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iFunktion_AuswertungGruppeNr,
|
|
@ifunktionsgruppenr,
|
|
@iAuswertungGruppeNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_auswertungGruppe_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_auswertungGruppe'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_auswertungGruppe_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Funktion_AuswertungGruppeNr],
|
|
[funktionsgruppenr],
|
|
[AuswertungGruppeNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[funktionsgruppe_auswertungGruppe]
|
|
ORDER BY
|
|
[Funktion_AuswertungGruppeNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Funktionsgruppe_AuswertungGruppe_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Funktionsgruppe_AuswertungGruppe_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.funktionsgruppe_auswertungGruppe.Funktion_AuswertungGruppeNr, dbo.funktionsgruppe_auswertungGruppe.funktionsgruppenr,
|
|
dbo.funktionsgruppe.bezeichnung AS Funktion, dbo.funktionsgruppe_auswertungGruppe.AuswertungGruppeNr,
|
|
dbo.AuswertungGruppe.Bezeichnung AS AuswertungGruppe, dbo.funktionsgruppe_auswertungGruppe.Aktiv, dbo.funktionsgruppe_auswertungGruppe.Erstellt_am,
|
|
dbo.funktionsgruppe_auswertungGruppe.Mutiert_am, dbo.funktionsgruppe_auswertungGruppe.Mutierer
|
|
FROM dbo.funktionsgruppe_auswertungGruppe INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.funktionsgruppe_auswertungGruppe.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.AuswertungGruppe ON dbo.funktionsgruppe_auswertungGruppe.AuswertungGruppeNr = dbo.AuswertungGruppe.AuswertungGruppeNr
|
|
where Funktionsgruppe_AuswertungGruppe.funktionsgruppenr=@keyvalue
|
|
ORDER BY dbo.funktionsgruppe_auswertungGruppe.Funktion_AuswertungGruppeNr
|
|
end else begin
|
|
SELECT dbo.funktionsgruppe_auswertungGruppe.Funktion_AuswertungGruppeNr, dbo.funktionsgruppe_auswertungGruppe.funktionsgruppenr,
|
|
dbo.funktionsgruppe.bezeichnung AS Funktion, dbo.funktionsgruppe_auswertungGruppe.AuswertungGruppeNr,
|
|
dbo.AuswertungGruppe.Bezeichnung AS AuswertungGruppe, dbo.funktionsgruppe_auswertungGruppe.Aktiv, dbo.funktionsgruppe_auswertungGruppe.Erstellt_am,
|
|
dbo.funktionsgruppe_auswertungGruppe.Mutiert_am, dbo.funktionsgruppe_auswertungGruppe.Mutierer
|
|
FROM dbo.funktionsgruppe_auswertungGruppe INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.funktionsgruppe_auswertungGruppe.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.AuswertungGruppe ON dbo.funktionsgruppe_auswertungGruppe.AuswertungGruppeNr = dbo.AuswertungGruppe.AuswertungGruppeNr
|
|
where Funktionsgruppe_AuswertungGruppe.AuswertungGruppeNr=@keyvalue
|
|
ORDER BY dbo.funktionsgruppe_auswertungGruppe.Funktion_AuswertungGruppeNr
|
|
|
|
|
|
end
|
|
-- SELECT all rows from the table.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_auswertungGruppe_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'funktionsgruppe_auswertungGruppe'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_auswertungGruppe_SelectOne]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Funktion_AuswertungGruppeNr],
|
|
[funktionsgruppenr],
|
|
[AuswertungGruppeNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[funktionsgruppe_auswertungGruppe]
|
|
WHERE
|
|
[Funktion_AuswertungGruppeNr] = @iFunktion_AuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_auswertungGruppe_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'funktionsgruppe_auswertungGruppe'
|
|
-- Gets: @iFunktion_AuswertungGruppeNr int
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @iAuswertungGruppeNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_auswertungGruppe_Update]
|
|
@iFunktion_AuswertungGruppeNr int,
|
|
@ifunktionsgruppenr int,
|
|
@iAuswertungGruppeNr 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_auswertungGruppe]
|
|
SET
|
|
[funktionsgruppenr] = @ifunktionsgruppenr,
|
|
[AuswertungGruppeNr] = @iAuswertungGruppeNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Funktion_AuswertungGruppeNr] = @iFunktion_AuswertungGruppeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'funktionsgruppe'
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @sbezeichnung varchar(50)
|
|
-- 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
|
|
-- Gets: @bfunktionszuweisung bit
|
|
-- Gets: @bbarcodeetiketten bit
|
|
-- Gets: @bedokapartner bit
|
|
-- Gets: @bDokumentreaktivierung bit
|
|
-- Gets: @bPartnerzusammenlegung bit
|
|
-- Gets: @bblv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_Insert]
|
|
@ifunktionsgruppenr int,
|
|
@sbezeichnung varchar(50),
|
|
@sbeschreibung varchar(50),
|
|
@szugehoerigkeit varchar(255),
|
|
@imandantnr int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@bfunktionszuweisung bit,
|
|
@bbarcodeetiketten bit,
|
|
@bedokapartner bit,
|
|
@bDokumentreaktivierung bit,
|
|
@bPartnerzusammenlegung bit,
|
|
@bblv bit,
|
|
@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],
|
|
[funktionszuweisung],
|
|
[barcodeetiketten],
|
|
[edokapartner],
|
|
[Dokumentreaktivierung],
|
|
[Partnerzusammenlegung],
|
|
[blv]
|
|
)
|
|
VALUES
|
|
(
|
|
@ifunktionsgruppenr,
|
|
@sbezeichnung,
|
|
@sbeschreibung,
|
|
@szugehoerigkeit,
|
|
@imandantnr,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@bfunktionszuweisung,
|
|
@bbarcodeetiketten,
|
|
@bedokapartner,
|
|
@bDokumentreaktivierung,
|
|
@bPartnerzusammenlegung,
|
|
@bblv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_rolle_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'funktionsgruppe_rolle'
|
|
-- using the Primary Key.
|
|
-- Gets: @iFunktionsgrupperollenr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_rolle_Delete]
|
|
@iFunktionsgrupperollenr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[funktionsgruppe_rolle]
|
|
WHERE
|
|
[Funktionsgrupperollenr] = @iFunktionsgrupperollenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_rolle_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'funktionsgruppe_rolle'
|
|
-- Gets: @iFunktionsgrupperollenr int
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @irollenr int
|
|
-- 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_rolle_Insert]
|
|
@iFunktionsgrupperollenr int,
|
|
@ifunktionsgruppenr int,
|
|
@irollenr int,
|
|
@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_rolle]
|
|
(
|
|
[Funktionsgrupperollenr],
|
|
[funktionsgruppenr],
|
|
[rollenr],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iFunktionsgrupperollenr,
|
|
@ifunktionsgruppenr,
|
|
@irollenr,
|
|
@imandantnr,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_rolle_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_rolle_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Funktionsgrupperollenr],
|
|
[funktionsgruppenr],
|
|
[rollenr],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[funktionsgruppe_rolle]
|
|
ORDER BY
|
|
[Funktionsgrupperollenr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_rolle_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_rolle_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.funktionsgruppe_rolle.Funktionsgrupperollenr, dbo.funktionsgruppe_rolle.funktionsgruppenr,
|
|
dbo.funktionsgruppe.bezeichnung AS Funktion, dbo.funktionsgruppe_rolle.rollenr, dbo.rolle.bezeichnung AS Rolle,
|
|
dbo.funktionsgruppe_rolle.mandantnr, dbo.funktionsgruppe_rolle.aktiv, dbo.funktionsgruppe_rolle.erstellt_am, dbo.funktionsgruppe_rolle.mutiert_am,
|
|
dbo.funktionsgruppe_rolle.mutierer
|
|
FROM dbo.funktionsgruppe_rolle INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.funktionsgruppe_rolle.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.rolle ON dbo.funktionsgruppe_rolle.rollenr = dbo.rolle.rollenr
|
|
where funktionsgruppe_rolle.funktionsgruppenr=@keyvalue
|
|
ORDER BY dbo.funktionsgruppe_rolle.Funktionsgrupperollenr
|
|
end else begin
|
|
SELECT dbo.funktionsgruppe_rolle.Funktionsgrupperollenr, dbo.funktionsgruppe_rolle.funktionsgruppenr,
|
|
dbo.funktionsgruppe.bezeichnung AS Funktion, dbo.funktionsgruppe_rolle.rollenr, dbo.rolle.bezeichnung AS Rolle,
|
|
dbo.funktionsgruppe_rolle.mandantnr, dbo.funktionsgruppe_rolle.aktiv, dbo.funktionsgruppe_rolle.erstellt_am, dbo.funktionsgruppe_rolle.mutiert_am,
|
|
dbo.funktionsgruppe_rolle.mutierer
|
|
FROM dbo.funktionsgruppe_rolle INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.funktionsgruppe_rolle.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.rolle ON dbo.funktionsgruppe_rolle.rollenr = dbo.rolle.rollenr
|
|
where funktionsgruppe_rolle.rollenr=@keyvalue
|
|
ORDER BY dbo.funktionsgruppe_rolle.Funktionsgrupperollenr
|
|
|
|
end
|
|
-- SELECT all rows from the table.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_rolle_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'funktionsgruppe_rolle'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iFunktionsgrupperollenr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_rolle_SelectOne]
|
|
@iFunktionsgrupperollenr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Funktionsgrupperollenr],
|
|
[funktionsgruppenr],
|
|
[rollenr],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[funktionsgruppe_rolle]
|
|
WHERE
|
|
[Funktionsgrupperollenr] = @iFunktionsgrupperollenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_rolle_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'funktionsgruppe_rolle'
|
|
-- Gets: @iFunktionsgrupperollenr int
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @irollenr int
|
|
-- 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_rolle_Update]
|
|
@iFunktionsgrupperollenr int,
|
|
@ifunktionsgruppenr int,
|
|
@irollenr int,
|
|
@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_rolle]
|
|
SET
|
|
[funktionsgruppenr] = @ifunktionsgruppenr,
|
|
[rollenr] = @irollenr,
|
|
[mandantnr] = @imandantnr,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer
|
|
WHERE
|
|
[Funktionsgrupperollenr] = @iFunktionsgrupperollenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
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],
|
|
[funktionszuweisung],
|
|
[barcodeetiketten],
|
|
[edokapartner],
|
|
[Dokumentreaktivierung],
|
|
[Partnerzusammenlegung],
|
|
[blv]
|
|
FROM [dbo].[funktionsgruppe]
|
|
ORDER BY
|
|
[funktionsgruppenr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
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],
|
|
[funktionszuweisung],
|
|
[barcodeetiketten],
|
|
[edokapartner],
|
|
[Dokumentreaktivierung],
|
|
[Partnerzusammenlegung],
|
|
[blv]
|
|
FROM [dbo].[funktionsgruppe]
|
|
WHERE
|
|
[funktionsgruppenr] = @ifunktionsgruppenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_funktionsgruppe_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'funktionsgruppe'
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @sbezeichnung varchar(50)
|
|
-- 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
|
|
-- Gets: @bfunktionszuweisung bit
|
|
-- Gets: @bbarcodeetiketten bit
|
|
-- Gets: @bedokapartner bit
|
|
-- Gets: @bDokumentreaktivierung bit
|
|
-- Gets: @bPartnerzusammenlegung bit
|
|
-- Gets: @bblv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_funktionsgruppe_Update]
|
|
@ifunktionsgruppenr int,
|
|
@sbezeichnung varchar(50),
|
|
@sbeschreibung varchar(50),
|
|
@szugehoerigkeit varchar(255),
|
|
@imandantnr int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@bfunktionszuweisung bit,
|
|
@bbarcodeetiketten bit,
|
|
@bedokapartner bit,
|
|
@bDokumentreaktivierung bit,
|
|
@bPartnerzusammenlegung bit,
|
|
@bblv bit,
|
|
@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,
|
|
[funktionszuweisung] = @bfunktionszuweisung,
|
|
[barcodeetiketten] = @bbarcodeetiketten,
|
|
[edokapartner] = @bedokapartner,
|
|
[Dokumentreaktivierung] = @bDokumentreaktivierung,
|
|
[Partnerzusammenlegung] = @bPartnerzusammenlegung,
|
|
[blv] = @bblv
|
|
WHERE
|
|
[funktionsgruppenr] = @ifunktionsgruppenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Gremium_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Gremium'
|
|
-- using the Primary Key.
|
|
-- Gets: @iGremiumNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Gremium_Delete]
|
|
@iGremiumNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Gremium]
|
|
WHERE
|
|
[GremiumNr] = @iGremiumNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Gremium_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Gremium'
|
|
-- Gets: @iGremiumNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bRFC_Board bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Gremium_Insert]
|
|
@iGremiumNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bRFC_Board bit,
|
|
@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].[Gremium]
|
|
(
|
|
[GremiumNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[RFC_Board],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iGremiumNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bRFC_Board,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Gremium_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Gremium'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Gremium_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[GremiumNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[RFC_Board],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Gremium]
|
|
ORDER BY
|
|
[GremiumNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Gremium_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Gremium'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iGremiumNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Gremium_SelectOne]
|
|
@iGremiumNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[GremiumNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[RFC_Board],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Gremium]
|
|
WHERE
|
|
[GremiumNr] = @iGremiumNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Gremium_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Gremium'
|
|
-- Gets: @iGremiumNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bRFC_Board bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Gremium_Update]
|
|
@iGremiumNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bRFC_Board bit,
|
|
@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].[Gremium]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[RFC_Board] = @bRFC_Board,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[GremiumNr] = @iGremiumNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumBereich_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'GremiumBereich'
|
|
-- using the Primary Key.
|
|
-- Gets: @iGremiumBereichNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumBereich_Delete]
|
|
@iGremiumBereichNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[GremiumBereich]
|
|
WHERE
|
|
[GremiumBereichNr] = @iGremiumBereichNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumBereich_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'GremiumBereich'
|
|
-- Gets: @iGremiumBereichNr int
|
|
-- Gets: @iGremiumGruppierungNr int
|
|
-- Gets: @sBereich varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iSortierung int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sKurzbezeichnung varchar(50)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumBereich_Insert]
|
|
@iGremiumBereichNr int,
|
|
@iGremiumGruppierungNr int,
|
|
@sBereich varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iSortierung int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sKurzbezeichnung varchar(50),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[GremiumBereich]
|
|
(
|
|
[GremiumBereichNr],
|
|
[GremiumGruppierungNr],
|
|
[Bereich],
|
|
[Beschreibung],
|
|
[Sortierung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Kurzbezeichnung]
|
|
)
|
|
VALUES
|
|
(
|
|
@iGremiumBereichNr,
|
|
@iGremiumGruppierungNr,
|
|
@sBereich,
|
|
@sBeschreibung,
|
|
@iSortierung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@sKurzbezeichnung
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumBereich_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'GremiumBereich'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumBereich_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[GremiumBereichNr],
|
|
[GremiumGruppierungNr],
|
|
[Bereich],
|
|
[Beschreibung],
|
|
[Sortierung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Kurzbezeichnung]
|
|
FROM [dbo].[GremiumBereich]
|
|
ORDER BY
|
|
[GremiumBereichNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumBereich_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'GremiumBereich'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iGremiumBereichNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumBereich_SelectOne]
|
|
@iGremiumBereichNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[GremiumBereichNr],
|
|
[GremiumGruppierungNr],
|
|
[Bereich],
|
|
[Beschreibung],
|
|
[Sortierung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Kurzbezeichnung]
|
|
FROM [dbo].[GremiumBereich]
|
|
WHERE
|
|
[GremiumBereichNr] = @iGremiumBereichNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumBereich_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'GremiumBereich'
|
|
-- Gets: @iGremiumBereichNr int
|
|
-- Gets: @iGremiumGruppierungNr int
|
|
-- Gets: @sBereich varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iSortierung int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sKurzbezeichnung varchar(50)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumBereich_Update]
|
|
@iGremiumBereichNr int,
|
|
@iGremiumGruppierungNr int,
|
|
@sBereich varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iSortierung int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sKurzbezeichnung varchar(50),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[GremiumBereich]
|
|
SET
|
|
[GremiumGruppierungNr] = @iGremiumGruppierungNr,
|
|
[Bereich] = @sBereich,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Sortierung] = @iSortierung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Kurzbezeichnung] = @sKurzbezeichnung
|
|
WHERE
|
|
[GremiumBereichNr] = @iGremiumBereichNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumGruppierung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'GremiumGruppierung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iGremiumGruppierungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumGruppierung_Delete]
|
|
@iGremiumGruppierungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[GremiumGruppierung]
|
|
WHERE
|
|
[GremiumGruppierungNr] = @iGremiumGruppierungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumGruppierung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'GremiumGruppierung'
|
|
-- Gets: @iGremiumGruppierungNr int
|
|
-- Gets: @iGremiumNr int
|
|
-- Gets: @sGruppierungsbegriff varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iReihenfolge int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumGruppierung_Insert]
|
|
@iGremiumGruppierungNr int,
|
|
@iGremiumNr int,
|
|
@sGruppierungsbegriff varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iReihenfolge 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].[GremiumGruppierung]
|
|
(
|
|
[GremiumGruppierungNr],
|
|
[GremiumNr],
|
|
[Gruppierungsbegriff],
|
|
[Beschreibung],
|
|
[Reihenfolge],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iGremiumGruppierungNr,
|
|
@iGremiumNr,
|
|
@sGruppierungsbegriff,
|
|
@sBeschreibung,
|
|
@iReihenfolge,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumGruppierung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'GremiumGruppierung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumGruppierung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[GremiumGruppierungNr],
|
|
[GremiumNr],
|
|
[Gruppierungsbegriff],
|
|
[Beschreibung],
|
|
[Reihenfolge],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[GremiumGruppierung]
|
|
ORDER BY
|
|
[GremiumGruppierungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumGruppierung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'GremiumGruppierung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iGremiumGruppierungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumGruppierung_SelectOne]
|
|
@iGremiumGruppierungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[GremiumGruppierungNr],
|
|
[GremiumNr],
|
|
[Gruppierungsbegriff],
|
|
[Beschreibung],
|
|
[Reihenfolge],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[GremiumGruppierung]
|
|
WHERE
|
|
[GremiumGruppierungNr] = @iGremiumGruppierungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumGruppierung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'GremiumGruppierung'
|
|
-- Gets: @iGremiumGruppierungNr int
|
|
-- Gets: @iGremiumNr int
|
|
-- Gets: @sGruppierungsbegriff varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iReihenfolge int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumGruppierung_Update]
|
|
@iGremiumGruppierungNr int,
|
|
@iGremiumNr int,
|
|
@sGruppierungsbegriff varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iReihenfolge 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].[GremiumGruppierung]
|
|
SET
|
|
[GremiumNr] = @iGremiumNr,
|
|
[Gruppierungsbegriff] = @sGruppierungsbegriff,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Reihenfolge] = @iReihenfolge,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[GremiumGruppierungNr] = @iGremiumGruppierungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumPerson_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'GremiumPerson'
|
|
-- using the Primary Key.
|
|
-- Gets: @iGreminPersonNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumPerson_Delete]
|
|
@iGreminPersonNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[GremiumPerson]
|
|
WHERE
|
|
[GreminPersonNr] = @iGreminPersonNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumPerson_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'GremiumPerson'
|
|
-- Gets: @iGreminPersonNr int
|
|
-- Gets: @iGremiumBereichNr int
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @bLeitung bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @iRolleNr int
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumPerson_Insert]
|
|
@iGreminPersonNr int,
|
|
@iGremiumBereichNr int,
|
|
@iPersonNr int,
|
|
@bLeitung bit,
|
|
@bAktiv bit,
|
|
@iRolleNr int,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sBeschreibung varchar(50),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[GremiumPerson]
|
|
(
|
|
[GreminPersonNr],
|
|
[GremiumBereichNr],
|
|
[PersonNr],
|
|
[Leitung],
|
|
[Aktiv],
|
|
[RolleNr],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Beschreibung]
|
|
)
|
|
VALUES
|
|
(
|
|
@iGreminPersonNr,
|
|
@iGremiumBereichNr,
|
|
@iPersonNr,
|
|
@bLeitung,
|
|
@bAktiv,
|
|
8,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@sBeschreibung
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumPerson_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'GremiumPerson'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumPerson_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[GreminPersonNr],
|
|
[GremiumBereichNr],
|
|
[PersonNr],
|
|
[Leitung],
|
|
[Aktiv],
|
|
[RolleNr],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Beschreibung]
|
|
FROM [dbo].[GremiumPerson]
|
|
ORDER BY
|
|
[GreminPersonNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumPerson_SelectAll_BottomTable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'GremiumPerson'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumPerson_SelectAll_BottomTable]
|
|
@iErrorCode int OUTPUT,
|
|
@fokus int,
|
|
@keyvalue varchar(10)
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT dbo.GremiumPerson.GreminPersonNr, dbo.GremiumPerson.GremiumBereichNr, dbo.GremiumPerson.PersonNr, dbo.GremiumPerson.Leitung,
|
|
dbo.GremiumPerson.Aktiv, dbo.GremiumPerson.RolleNr, dbo.GremiumPerson.Erstellt_am, dbo.GremiumPerson.Mutiert_am, dbo.GremiumPerson.Mutierer,
|
|
dbo.Person.Name + ' ' + dbo.Person.Vorname AS Personenname, dbo.gremiumPerson.Beschreibung
|
|
FROM dbo.GremiumPerson INNER JOIN
|
|
dbo.Person ON dbo.GremiumPerson.PersonNr = dbo.Person.PersonNr
|
|
ORDER BY
|
|
[GreminPersonNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumPerson_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'GremiumPerson'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iGreminPersonNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumPerson_SelectOne]
|
|
@iGreminPersonNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[GreminPersonNr],
|
|
[GremiumBereichNr],
|
|
[PersonNr],
|
|
[Leitung],
|
|
[Aktiv],
|
|
[RolleNr],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Beschreibung]
|
|
FROM [dbo].[GremiumPerson]
|
|
WHERE
|
|
[GreminPersonNr] = @iGreminPersonNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_GremiumPerson_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'GremiumPerson'
|
|
-- Gets: @iGreminPersonNr int
|
|
-- Gets: @iGremiumBereichNr int
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @bLeitung bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @iRolleNr int
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_GremiumPerson_Update]
|
|
@iGreminPersonNr int,
|
|
@iGremiumBereichNr int,
|
|
@iPersonNr int,
|
|
@bLeitung bit,
|
|
@bAktiv bit,
|
|
@iRolleNr int,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sBeschreibung varchar(50),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[GremiumPerson]
|
|
SET
|
|
[GremiumBereichNr] = @iGremiumBereichNr,
|
|
[PersonNr] = @iPersonNr,
|
|
[Leitung] = @bLeitung,
|
|
[Aktiv] = @bAktiv,
|
|
[RolleNr] = @iRolleNr,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Beschreibung] = @sBeschreibung
|
|
WHERE
|
|
[GreminPersonNr] = @iGreminPersonNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_History_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'History'
|
|
-- using the Primary Key.
|
|
-- Gets: @iHistoryNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_History_Delete]
|
|
@iHistoryNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[History]
|
|
WHERE
|
|
[HistoryNr] = @iHistoryNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_History_Ereignis_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'History for a Vertragsereignis (Typ 2)'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_History_Ereignis_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'History for a Vertragsereignis (Typ 2)'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT dbo.History.HistoryNr, dbo.HistoryTyp.Historytypnr, dbo.HistoryTyp.Bezeichnung, dbo.History.HistoryObject, dbo.History.HistoryObjekctKey,
|
|
dbo.History.HistoryObjectDetails, dbo.History.Alter_Wert, dbo.History.Neuer_Wert, dbo.History.Erstellt_am, dbo.History.Mutierer
|
|
FROM dbo.HistoryTyp INNER JOIN
|
|
dbo.History ON dbo.HistoryTyp.Historytypnr = dbo.History.HistoryTypNr
|
|
where dbo.history.historytypnr=2 and dbo.history.HistoryObjekctKey=@keyvalue
|
|
order by dbo.history.Erstellt_am desc
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_History_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_History_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'History'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_History_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[HistoryNr],
|
|
[HistoryTypNr],
|
|
[HistoryObject],
|
|
[HistoryObjekctKey],
|
|
[HistoryObjectDetails],
|
|
[Alter_Wert],
|
|
[Neuer_Wert],
|
|
[Erstellt_am],
|
|
[Mutierer]
|
|
FROM [dbo].[History]
|
|
ORDER BY
|
|
[HistoryNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_History_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'History for a Vertragselement (Typ=1)'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_History_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'History for a Vertragselement (Typ=1)'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT dbo.History.HistoryNr, dbo.HistoryTyp.Historytypnr, dbo.HistoryTyp.Bezeichnung, dbo.History.HistoryObject, dbo.History.HistoryObjekctKey,
|
|
dbo.History.HistoryObjectDetails, dbo.History.Alter_Wert, dbo.History.Neuer_Wert, dbo.History.Erstellt_am, dbo.History.Mutierer
|
|
FROM dbo.HistoryTyp INNER JOIN
|
|
dbo.History ON dbo.HistoryTyp.Historytypnr = dbo.History.HistoryTypNr
|
|
where dbo.history.historytypnr=1 and dbo.history.HistoryObjekctKey=@keyvalue
|
|
order by dbo.history.Erstellt_am desc
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_History_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'History'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iHistoryNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_History_SelectOne]
|
|
@iHistoryNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[HistoryNr],
|
|
[HistoryTypNr],
|
|
[HistoryObject],
|
|
[HistoryObjekctKey],
|
|
[HistoryObjectDetails],
|
|
[Alter_Wert],
|
|
[Neuer_Wert],
|
|
[Erstellt_am],
|
|
[Mutierer]
|
|
FROM [dbo].[History]
|
|
WHERE
|
|
[HistoryNr] = @iHistoryNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_History_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'History'
|
|
-- Gets: @iHistoryNr int
|
|
-- 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: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_History_Update]
|
|
@iHistoryNr int,
|
|
@iHistoryTypNr int,
|
|
@sHistoryObject varchar(50),
|
|
@sHistoryObjekctKey varchar(50),
|
|
@sHistoryObjectDetails varchar(50),
|
|
@sAlter_Wert varchar(50),
|
|
@sNeuer_Wert varchar(50),
|
|
@daErstellt_am datetime,
|
|
@iMutierer int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[History]
|
|
SET
|
|
[HistoryTypNr] = @iHistoryTypNr,
|
|
[HistoryObject] = @sHistoryObject,
|
|
[HistoryObjekctKey] = @sHistoryObjekctKey,
|
|
[HistoryObjectDetails] = @sHistoryObjectDetails,
|
|
[Alter_Wert] = @sAlter_Wert,
|
|
[Neuer_Wert] = @sNeuer_Wert,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[HistoryNr] = @iHistoryNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_HistoryTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'HistoryTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iHistorytypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_HistoryTyp_Delete]
|
|
@iHistorytypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[HistoryTyp]
|
|
WHERE
|
|
[Historytypnr] = @iHistorytypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_HistoryTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'HistoryTyp'
|
|
-- Gets: @iHistorytypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_HistoryTyp_Insert]
|
|
@iHistorytypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[HistoryTyp]
|
|
(
|
|
[Historytypnr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iHistorytypnr,
|
|
@sBezeichnung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_HistoryTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'HistoryTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_HistoryTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Historytypnr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[HistoryTyp]
|
|
ORDER BY
|
|
[Historytypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_HistoryTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'HistoryTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iHistorytypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_HistoryTyp_SelectOne]
|
|
@iHistorytypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Historytypnr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[HistoryTyp]
|
|
WHERE
|
|
[Historytypnr] = @iHistorytypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_HistoryTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'HistoryTyp'
|
|
-- Gets: @iHistorytypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_HistoryTyp_Update]
|
|
@iHistorytypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[HistoryTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr
|
|
WHERE
|
|
[Historytypnr] = @iHistorytypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationAlsTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'InstallationAlsTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iInstallationAlsTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationAlsTyp_Delete]
|
|
@iInstallationAlsTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[InstallationAlsTyp]
|
|
WHERE
|
|
[InstallationAlsTypNr] = @iInstallationAlsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationAlsTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'InstallationAlsTyp'
|
|
-- Gets: @iInstallationAlsTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationAlsTyp_Insert]
|
|
@iInstallationAlsTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[InstallationAlsTyp]
|
|
(
|
|
[InstallationAlsTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iInstallationAlsTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationAlsTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'InstallationAlsTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationAlsTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[InstallationAlsTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[InstallationAlsTyp]
|
|
ORDER BY
|
|
[InstallationAlsTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationAlsTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'InstallationAlsTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iInstallationAlsTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationAlsTyp_SelectOne]
|
|
@iInstallationAlsTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[InstallationAlsTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[InstallationAlsTyp]
|
|
WHERE
|
|
[InstallationAlsTypNr] = @iInstallationAlsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationAlsTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'InstallationAlsTyp'
|
|
-- Gets: @iInstallationAlsTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationAlsTyp_Update]
|
|
@iInstallationAlsTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[InstallationAlsTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[InstallationAlsTypNr] = @iInstallationAlsTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'InstallationTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationTyp_Delete]
|
|
@iInstallationTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[InstallationTyp]
|
|
WHERE
|
|
[InstallationTypNr] = @iInstallationTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'InstallationTyp'
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstllt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationTyp_Insert]
|
|
@iInstallationTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstllt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[InstallationTyp]
|
|
(
|
|
[InstallationTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Sort]
|
|
)
|
|
VALUES
|
|
(
|
|
@iInstallationTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstllt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iSort
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'InstallationTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[InstallationTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Sort]
|
|
FROM [dbo].[InstallationTyp]
|
|
ORDER BY
|
|
[InstallationTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'InstallationTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationTyp_SelectOne]
|
|
@iInstallationTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[InstallationTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Sort]
|
|
FROM [dbo].[InstallationTyp]
|
|
WHERE
|
|
[InstallationTypNr] = @iInstallationTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_InstallationTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'InstallationTyp'
|
|
-- Gets: @iInstallationTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstllt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_InstallationTyp_Update]
|
|
@iInstallationTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstllt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[InstallationTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstllt_am] = @daErstllt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Sort] = @iSort
|
|
WHERE
|
|
[InstallationTypNr] = @iInstallationTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ITSPProdukt_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ITSPProdukt'
|
|
-- using the Primary Key.
|
|
-- Gets: @iITSPProduktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ITSPProdukt_Delete]
|
|
@iITSPProduktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ITSPProdukt]
|
|
WHERE
|
|
[ITSPProduktnr] = @iITSPProduktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ITSPProdukt_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ITSPProdukt'
|
|
-- Gets: @iITSPProduktnr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ITSPProdukt_Insert]
|
|
@iITSPProduktnr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[ITSPProdukt]
|
|
(
|
|
[ITSPProduktnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iITSPProduktnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ITSPProdukt_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ITSPProdukt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ITSPProdukt_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ITSPProduktnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ITSPProdukt]
|
|
ORDER BY
|
|
[ITSPProduktnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ITSPProdukt_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ITSPProdukt'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iITSPProduktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ITSPProdukt_SelectOne]
|
|
@iITSPProduktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ITSPProduktnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ITSPProdukt]
|
|
WHERE
|
|
[ITSPProduktnr] = @iITSPProduktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ITSPProdukt_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ITSPProdukt'
|
|
-- Gets: @iITSPProduktnr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ITSPProdukt_Update]
|
|
@iITSPProduktnr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[ITSPProdukt]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ITSPProduktnr] = @iITSPProduktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Jahrestabelle_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Jahrestabelle'
|
|
-- using the Primary Key.
|
|
-- Gets: @iEintragnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Jahrestabelle_Delete]
|
|
@iEintragnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Jahrestabelle]
|
|
WHERE
|
|
[Eintragnr] = @iEintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Jahrestabelle_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Jahrestabelle'
|
|
-- Gets: @iEintragnr int
|
|
-- Gets: @iJahr int
|
|
-- Gets: @iMonat int
|
|
-- Gets: @iPlantage int
|
|
-- Gets: @iFaktorNr int
|
|
-- Gets: @iArbeitstage int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Jahrestabelle_Insert]
|
|
@iEintragnr int,
|
|
@iJahr int,
|
|
@iMonat int,
|
|
@iPlantage int,
|
|
@iFaktorNr int,
|
|
@iArbeitstage 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].[Jahrestabelle]
|
|
(
|
|
[Eintragnr],
|
|
[Jahr],
|
|
[Monat],
|
|
[Plantage],
|
|
[FaktorNr],
|
|
[Arbeitstage],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iEintragnr,
|
|
@iJahr,
|
|
@iMonat,
|
|
@iPlantage,
|
|
@iFaktorNr,
|
|
@iArbeitstage,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Jahrestabelle_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Jahrestabelle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Jahrestabelle_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Eintragnr],
|
|
[Jahr],
|
|
[Monat],
|
|
[Plantage],
|
|
[FaktorNr],
|
|
[Arbeitstage],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Jahrestabelle]
|
|
ORDER BY
|
|
[Eintragnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Jahrestabelle_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Jahrestabelle'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iEintragnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Jahrestabelle_SelectOne]
|
|
@iEintragnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Eintragnr],
|
|
[Jahr],
|
|
[Monat],
|
|
[Plantage],
|
|
[FaktorNr],
|
|
[Arbeitstage],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Jahrestabelle]
|
|
WHERE
|
|
[Eintragnr] = @iEintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Jahrestabelle_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Jahrestabelle'
|
|
-- Gets: @iEintragnr int
|
|
-- Gets: @iJahr int
|
|
-- Gets: @iMonat int
|
|
-- Gets: @iPlantage int
|
|
-- Gets: @iFaktorNr int
|
|
-- Gets: @iArbeitstage int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Jahrestabelle_Update]
|
|
@iEintragnr int,
|
|
@iJahr int,
|
|
@iMonat int,
|
|
@iPlantage int,
|
|
@iFaktorNr int,
|
|
@iArbeitstage 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].[Jahrestabelle]
|
|
SET
|
|
[Jahr] = @iJahr,
|
|
[Monat] = @iMonat,
|
|
[Plantage] = @iPlantage,
|
|
[FaktorNr] = @iFaktorNr,
|
|
[Arbeitstage] = @iArbeitstage,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Eintragnr] = @iEintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_key_tabelle_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'key_tabelle'
|
|
-- using the Primary Key.
|
|
-- Gets: @ikeynr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_key_tabelle_Delete]
|
|
@ikeynr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[key_tabelle]
|
|
WHERE
|
|
[keynr] = @ikeynr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_key_tabelle_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'key_tabelle'
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @ikey_wert int
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @ikeynr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_key_tabelle_Insert]
|
|
@sbeschreibung varchar(255),
|
|
@ikey_wert int,
|
|
@imandantnr int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@ikeynr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[key_tabelle]
|
|
(
|
|
[beschreibung],
|
|
[key_wert],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@sbeschreibung,
|
|
@ikey_wert,
|
|
@imandantnr,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @ikeynr=SCOPE_IDENTITY()
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_key_tabelle_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'key_tabelle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_key_tabelle_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[keynr],
|
|
[beschreibung],
|
|
[key_wert],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[key_tabelle]
|
|
ORDER BY
|
|
[keynr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_key_tabelle_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'key_tabelle'
|
|
-- based on the Primary Key.
|
|
-- Gets: @ikeynr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_key_tabelle_SelectOne]
|
|
@ikeynr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[keynr],
|
|
[beschreibung],
|
|
[key_wert],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[key_tabelle]
|
|
WHERE
|
|
[keynr] = @ikeynr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_key_tabelle_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'key_tabelle'
|
|
-- Gets: @ikeynr int
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @ikey_wert int
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_key_tabelle_Update]
|
|
@ikeynr int,
|
|
@sbeschreibung varchar(255),
|
|
@ikey_wert int,
|
|
@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].[key_tabelle]
|
|
SET
|
|
[beschreibung] = @sbeschreibung,
|
|
[key_wert] = @ikey_wert,
|
|
[mandantnr] = @imandantnr,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer
|
|
WHERE
|
|
[keynr] = @ikeynr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kontakttyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Kontakttyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iKontakttypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kontakttyp_Delete]
|
|
@iKontakttypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Kontakttyp]
|
|
WHERE
|
|
[KontakttypNr] = @iKontakttypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kontakttyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Kontakttyp'
|
|
-- Gets: @iKontakttypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iApplikationsbereichNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kontakttyp_Insert]
|
|
@iKontakttypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iApplikationsbereichNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Kontakttyp]
|
|
(
|
|
[KontakttypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[ApplikationsbereichNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iKontakttypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@iApplikationsbereichNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kontakttyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kontakttyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kontakttyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[KontakttypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[ApplikationsbereichNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Kontakttyp]
|
|
ORDER BY
|
|
[KontakttypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kontakttyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Kontakttyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iKontakttypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kontakttyp_SelectOne]
|
|
@iKontakttypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[KontakttypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[ApplikationsbereichNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Kontakttyp]
|
|
WHERE
|
|
[KontakttypNr] = @iKontakttypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kontakttyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Kontakttyp'
|
|
-- Gets: @iKontakttypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iApplikationsbereichNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kontakttyp_Update]
|
|
@iKontakttypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iApplikationsbereichNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Kontakttyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[ApplikationsbereichNr] = @iApplikationsbereichNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[KontakttypNr] = @iKontakttypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kostenart_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Kostenart'
|
|
-- using the Primary Key.
|
|
-- Gets: @iKostenartNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kostenart_Delete]
|
|
@iKostenartNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Kostenart]
|
|
WHERE
|
|
[KostenartNr] = @iKostenartNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kostenart_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Kostenart'
|
|
-- Gets: @iKostenartNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kostenart_Insert]
|
|
@iKostenartNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Kostenart]
|
|
(
|
|
[KostenartNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iKostenartNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kostenart_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kostenart'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kostenart_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[KostenartNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[Kostenart]
|
|
ORDER BY
|
|
[KostenartNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kostenart_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Kostenart'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iKostenartNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kostenart_SelectOne]
|
|
@iKostenartNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[KostenartNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[Kostenart]
|
|
WHERE
|
|
[KostenartNr] = @iKostenartNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kostenart_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Kostenart'
|
|
-- Gets: @iKostenartNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kostenart_Update]
|
|
@iKostenartNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Kostenart]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr
|
|
WHERE
|
|
[KostenartNr] = @iKostenartNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Kuendigungsfrist'
|
|
-- using the Primary Key.
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_Delete]
|
|
@iKuendigungsfristNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Kuendigungsfrist]
|
|
WHERE
|
|
[KuendigungsfristNr] = @iKuendigungsfristNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_DeleteAllWVertragselementNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Kuendigungsfrist'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragselementNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_DeleteAllWVertragselementNrLogic]
|
|
@iVertragselementNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Kuendigungsfrist]
|
|
WHERE
|
|
[VertragselementNr] = @iVertragselementNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Kuendigungsfrist'
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @sVarZeitspanne varchar(255)
|
|
-- Gets: @sKuendigungsfirst varchar(255)
|
|
-- Gets: @daKuendigungstermin datetime
|
|
-- Gets: @sBemerkung varchar(50)
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_Insert]
|
|
@iKuendigungsfristNr int,
|
|
@iVertragselementNr int,
|
|
@sVarZeitspanne varchar(255),
|
|
@sKuendigungsfirst varchar(255),
|
|
@daKuendigungstermin datetime,
|
|
@sBemerkung varchar(50),
|
|
@iSecurityLevelNr int,
|
|
@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].[Kuendigungsfrist]
|
|
(
|
|
[KuendigungsfristNr],
|
|
[VertragselementNr],
|
|
[VarZeitspanne],
|
|
[Kuendigungsfirst],
|
|
[Kuendigungstermin],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@iKuendigungsfristNr,
|
|
@iVertragselementNr,
|
|
@sVarZeitspanne,
|
|
@sKuendigungsfirst,
|
|
@daKuendigungstermin,
|
|
@sBemerkung,
|
|
@iSecurityLevelNr,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[KuendigungsfristNr],
|
|
[VertragselementNr],
|
|
[VarZeitspanne],
|
|
[Kuendigungsfirst],
|
|
[Kuendigungstermin],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Kuendigungsfrist]
|
|
ORDER BY
|
|
[KuendigungsfristNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
Create proc [dbo].[pr_Kuendigungsfrist_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
|
|
SELECT dbo.Vertragsereignis.EreignisNr, dbo.Vertragsereignis.Vertragselementnr, dbo.Vertragsereignis.EreignistypNr, dbo.Ereignistyp.Bezeichnung AS Ereignistyp,
|
|
dbo.Vertragsereignis.PeriodizitaetNr, dbo.Periodizitaet.Bezeichnung AS Periodizitaet, dbo.Vertragsereignis.Bezeichnung,
|
|
dbo.Kuendigungsfristen.Bezeichnung AS Kuendigungsfrist, dbo.Vertragsereignis.Beschreibung, dbo.check_date(dbo.Vertragsereignis.Datum) as Datum, dbo.check_date(dbo.Vertragsereignis.Start) as Start,
|
|
dbo.check_date(dbo.Vertragsereignis.Ende) as Ende, dbo.Vertragsereignis.Vorlaufzeit, dbo.Vertragsereignis.Aktiv, dbo.Vertragsereignis.Erstellt_am, dbo.Vertragsereignis.Mutiert_am,
|
|
dbo.Vertragsereignis.Mutierer, dbo.Vertragsereignis.SecurityLevelNr
|
|
FROM dbo.Vertragsereignis INNER JOIN
|
|
dbo.Ereignistyp ON dbo.Vertragsereignis.EreignistypNr = dbo.Ereignistyp.Ereignistypnr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Vertragsereignis.PeriodizitaetNr = dbo.Periodizitaet.PeriodizitaetNr INNER JOIN
|
|
dbo.Kuendigungsfristen ON dbo.Vertragsereignis.Kuendigungsfristnr = dbo.Kuendigungsfristen.KuendigungsfristNr
|
|
where dbo.vertragsereignis.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and vertragselementnr = @keyvalue and dbo.ereignistyp.kuendigung=1
|
|
order by EreignisNr
|
|
|
|
---- SELECT all rows from the table.
|
|
--SELECT
|
|
-- [KuendigungsfristNr],
|
|
-- [VertragselementNr],
|
|
-- [VarZeitspanne],
|
|
-- [Kuendigungsfirst],
|
|
-- [Kuendigungstermin],
|
|
-- [Bemerkung],
|
|
-- [SecurityLevelNr],
|
|
-- [Erstellt_am],
|
|
-- [Mutiert_am],
|
|
-- [Mutierer],
|
|
-- [Aktiv]
|
|
--FROM [dbo].[Kuendigungsfrist]
|
|
--where dbo.Kuendigungsfrist.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and vertragselementnr = @keyvalue
|
|
--ORDER BY
|
|
-- [KuendigungsfristNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_SelectAllWVertragselementNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Kuendigungsfrist'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragselementNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_SelectAllWVertragselementNrLogic]
|
|
@iVertragselementNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[KuendigungsfristNr],
|
|
[VertragselementNr],
|
|
[VarZeitspanne],
|
|
[Kuendigungsfirst],
|
|
[Kuendigungstermin],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Kuendigungsfrist]
|
|
WHERE
|
|
[VertragselementNr] = @iVertragselementNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Kuendigungsfrist'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_SelectOne]
|
|
@iKuendigungsfristNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[KuendigungsfristNr],
|
|
[VertragselementNr],
|
|
[VarZeitspanne],
|
|
[Kuendigungsfirst],
|
|
[Kuendigungstermin],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Kuendigungsfrist]
|
|
WHERE
|
|
[KuendigungsfristNr] = @iKuendigungsfristNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Kuendigungsfrist'
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @sVarZeitspanne varchar(255)
|
|
-- Gets: @sKuendigungsfirst varchar(255)
|
|
-- Gets: @daKuendigungstermin datetime
|
|
-- Gets: @sBemerkung varchar(50)
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_Update]
|
|
@iKuendigungsfristNr int,
|
|
@iVertragselementNr int,
|
|
@sVarZeitspanne varchar(255),
|
|
@sKuendigungsfirst varchar(255),
|
|
@daKuendigungstermin datetime,
|
|
@sBemerkung varchar(50),
|
|
@iSecurityLevelNr int,
|
|
@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].[Kuendigungsfrist]
|
|
SET
|
|
[VertragselementNr] = @iVertragselementNr,
|
|
[VarZeitspanne] = @sVarZeitspanne,
|
|
[Kuendigungsfirst] = @sKuendigungsfirst,
|
|
[Kuendigungstermin] = @daKuendigungstermin,
|
|
[Bemerkung] = @sBemerkung,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv
|
|
WHERE
|
|
[KuendigungsfristNr] = @iKuendigungsfristNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfrist_UpdateAllWVertragselementNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Kuendigungsfrist'.
|
|
-- Will reset field [VertragselementNr] with value @iVertragselementNrOld to value @iVertragselementNr
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @iVertragselementNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfrist_UpdateAllWVertragselementNrLogic]
|
|
@iVertragselementNr int,
|
|
@iVertragselementNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Kuendigungsfrist]
|
|
SET
|
|
[VertragselementNr] = @iVertragselementNr
|
|
WHERE
|
|
[VertragselementNr] = @iVertragselementNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfristen_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Kuendigungsfristen'
|
|
-- using the Primary Key.
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfristen_Delete]
|
|
@iKuendigungsfristNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Kuendigungsfristen]
|
|
WHERE
|
|
[KuendigungsfristNr] = @iKuendigungsfristNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfristen_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Kuendigungsfristen'
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iTage int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfristen_Insert]
|
|
@iKuendigungsfristNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iTage int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@imutierer int,
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Kuendigungsfristen]
|
|
(
|
|
[KuendigungsfristNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Tage],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[mutierer],
|
|
[Sort]
|
|
)
|
|
VALUES
|
|
(
|
|
@iKuendigungsfristNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@iTage,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@imutierer,
|
|
@iSort
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfristen_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfristen'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfristen_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[KuendigungsfristNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Tage],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[mutierer],
|
|
[Sort]
|
|
FROM [dbo].[Kuendigungsfristen]
|
|
ORDER BY
|
|
[KuendigungsfristNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfristen_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Kuendigungsfristen'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfristen_SelectOne]
|
|
@iKuendigungsfristNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[KuendigungsfristNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Tage],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[mutierer],
|
|
[Sort]
|
|
FROM [dbo].[Kuendigungsfristen]
|
|
WHERE
|
|
[KuendigungsfristNr] = @iKuendigungsfristNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Kuendigungsfristen_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Kuendigungsfristen'
|
|
-- Gets: @iKuendigungsfristNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @iTage int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Kuendigungsfristen_Update]
|
|
@iKuendigungsfristNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@iTage int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@imutierer int,
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Kuendigungsfristen]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Tage] = @iTage,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[Sort] = @iSort
|
|
WHERE
|
|
[KuendigungsfristNr] = @iKuendigungsfristNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokument_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokument_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokument_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokument_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokument_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageort_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageort_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageort_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageort_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageort_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_DokumentAblageTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokumenttyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokumenttyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokumenttyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokumenttyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Dokumenttyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
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
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Einsatzgebiet_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Einsatzgebiet'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLC_EinsatzgebietNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Einsatzgebiet_Delete]
|
|
@iLC_EinsatzgebietNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Einsatzgebiet]
|
|
WHERE
|
|
[LC_EinsatzgebietNr] = @iLC_EinsatzgebietNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Einsatzgebiet_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Einsatzgebiet'
|
|
-- Gets: @iLC_EinsatzgebietNr_Parent int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @daErstllt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @iImagenr int
|
|
-- Returns: @iLC_EinsatzgebietNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Einsatzgebiet_Insert]
|
|
@iLC_EinsatzgebietNr_Parent int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@daErstllt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@iImagenr int,
|
|
@iLC_EinsatzgebietNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[LC_Einsatzgebiet]
|
|
(
|
|
[LC_EinsatzgebietNr_Parent],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Imagenr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLC_EinsatzgebietNr_Parent,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@daErstllt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv,
|
|
@iImagenr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iLC_EinsatzgebietNr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Einsatzgebiet_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Einsatzgebiet'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Einsatzgebiet_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LC_EinsatzgebietNr],
|
|
[LC_EinsatzgebietNr_Parent],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Imagenr]
|
|
FROM [dbo].[LC_Einsatzgebiet]
|
|
ORDER BY
|
|
[LC_EinsatzgebietNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Einsatzgebiet_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Einsatzgebiet'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLC_EinsatzgebietNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Einsatzgebiet_SelectOne]
|
|
@iLC_EinsatzgebietNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LC_EinsatzgebietNr],
|
|
[LC_EinsatzgebietNr_Parent],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstllt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Imagenr]
|
|
FROM [dbo].[LC_Einsatzgebiet]
|
|
WHERE
|
|
[LC_EinsatzgebietNr] = @iLC_EinsatzgebietNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Einsatzgebiet_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Einsatzgebiet'
|
|
-- Gets: @iLC_EinsatzgebietNr int
|
|
-- Gets: @iLC_EinsatzgebietNr_Parent int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @daErstllt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @iImagenr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Einsatzgebiet_Update]
|
|
@iLC_EinsatzgebietNr int,
|
|
@iLC_EinsatzgebietNr_Parent int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@daErstllt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@iImagenr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[LC_Einsatzgebiet]
|
|
SET
|
|
[LC_EinsatzgebietNr_Parent] = @iLC_EinsatzgebietNr_Parent,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Erstllt_am] = @daErstllt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv,
|
|
[Imagenr] = @iImagenr
|
|
WHERE
|
|
[LC_EinsatzgebietNr] = @iLC_EinsatzgebietNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Optionen_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Optionen'
|
|
-- using the Primary Key.
|
|
-- Gets: @ilc_option_nr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Optionen_Delete]
|
|
@ilc_option_nr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Optionen]
|
|
WHERE
|
|
[lc_option_nr] = @ilc_option_nr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Optionen_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Optionen'
|
|
-- Gets: @sbezeichung varchar(255)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @baktiv bit
|
|
-- Returns: @ilc_option_nr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Optionen_Insert]
|
|
@sbezeichung varchar(255),
|
|
@sbeschreibung varchar(255),
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@baktiv bit,
|
|
@ilc_option_nr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[LC_Optionen]
|
|
(
|
|
[bezeichung],
|
|
[beschreibung],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@sbezeichung,
|
|
@sbeschreibung,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@baktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @ilc_option_nr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Optionen_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Optionen'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Optionen_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[lc_option_nr],
|
|
[bezeichung],
|
|
[beschreibung],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[aktiv]
|
|
FROM [dbo].[LC_Optionen]
|
|
ORDER BY
|
|
[lc_option_nr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Optionen_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Optionen'
|
|
-- based on the Primary Key.
|
|
-- Gets: @ilc_option_nr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Optionen_SelectOne]
|
|
@ilc_option_nr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[lc_option_nr],
|
|
[bezeichung],
|
|
[beschreibung],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[aktiv]
|
|
FROM [dbo].[LC_Optionen]
|
|
WHERE
|
|
[lc_option_nr] = @ilc_option_nr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Optionen_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Optionen'
|
|
-- Gets: @ilc_option_nr int
|
|
-- Gets: @sbezeichung varchar(255)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @baktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Optionen_Update]
|
|
@ilc_option_nr int,
|
|
@sbezeichung varchar(255),
|
|
@sbeschreibung 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_Optionen]
|
|
SET
|
|
[bezeichung] = @sbezeichung,
|
|
[beschreibung] = @sbeschreibung,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[aktiv] = @baktiv
|
|
WHERE
|
|
[lc_option_nr] = @ilc_option_nr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Phase_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Phase'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLC_PhaseNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Phase_Delete]
|
|
@iLC_PhaseNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Phase]
|
|
WHERE
|
|
[LC_PhaseNr] = @iLC_PhaseNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Phase_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Phase'
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iLC_PhaseNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Phase_Insert]
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(1024),
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@iLC_PhaseNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[LC_Phase]
|
|
(
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iLC_PhaseNr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Phase_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Phase'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Phase_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LC_PhaseNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_Phase]
|
|
ORDER BY
|
|
[LC_PhaseNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Phase_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Phase'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLC_PhaseNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Phase_SelectOne]
|
|
@iLC_PhaseNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LC_PhaseNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_Phase]
|
|
WHERE
|
|
[LC_PhaseNr] = @iLC_PhaseNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Phase_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Phase'
|
|
-- Gets: @iLC_PhaseNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Phase_Update]
|
|
@iLC_PhaseNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(1024),
|
|
@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_Phase]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv
|
|
WHERE
|
|
[LC_PhaseNr] = @iLC_PhaseNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Copy_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Produkt_Copy'
|
|
-- using the Primary Key.
|
|
-- Gets: @ilc_produkt_copynr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Copy_Delete]
|
|
@ilc_produkt_copynr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Produkt_Copy]
|
|
WHERE
|
|
[lc_produkt_copynr] = @ilc_produkt_copynr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Copy_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Produkt_Copy'
|
|
-- Gets: @ilc_produkt_copynr int
|
|
-- Gets: @ilc_produkt_parentnr int
|
|
-- Gets: @ilc_produktnr int
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @baktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Copy_Insert]
|
|
@ilc_produkt_copynr int,
|
|
@ilc_produkt_parentnr int,
|
|
@ilc_produktnr int,
|
|
@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_Produkt_Copy]
|
|
(
|
|
[lc_produkt_copynr],
|
|
[lc_produkt_parentnr],
|
|
[lc_produktnr],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@ilc_produkt_copynr,
|
|
@ilc_produkt_parentnr,
|
|
@ilc_produktnr,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@baktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Copy_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Produkt_Copy'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Copy_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[lc_produkt_copynr],
|
|
[lc_produkt_parentnr],
|
|
[lc_produktnr],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[aktiv]
|
|
FROM [dbo].[LC_Produkt_Copy]
|
|
ORDER BY
|
|
[lc_produkt_copynr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Copy_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Produkt_Copy'
|
|
-- based on the Primary Key.
|
|
-- Gets: @ilc_produkt_copynr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Copy_SelectOne]
|
|
@ilc_produkt_copynr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[lc_produkt_copynr],
|
|
[lc_produkt_parentnr],
|
|
[lc_produktnr],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[aktiv]
|
|
FROM [dbo].[LC_Produkt_Copy]
|
|
WHERE
|
|
[lc_produkt_copynr] = @ilc_produkt_copynr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Copy_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Produkt_Copy'
|
|
-- Gets: @ilc_produkt_copynr int
|
|
-- Gets: @ilc_produkt_parentnr int
|
|
-- Gets: @ilc_produktnr int
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @baktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Copy_Update]
|
|
@ilc_produkt_copynr int,
|
|
@ilc_produkt_parentnr int,
|
|
@ilc_produktnr int,
|
|
@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_Produkt_Copy]
|
|
SET
|
|
[lc_produkt_parentnr] = @ilc_produkt_parentnr,
|
|
[lc_produktnr] = @ilc_produktnr,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[aktiv] = @baktiv
|
|
WHERE
|
|
[lc_produkt_copynr] = @ilc_produkt_copynr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Produkt'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Delete]
|
|
@iLC_ProduktNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Produkt]
|
|
WHERE
|
|
[LC_ProduktNr] = @iLC_ProduktNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Dokument_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Produkt_Dokument'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLC_Produkt_DokumentNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Dokument_Delete]
|
|
@iLC_Produkt_DokumentNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Produkt_Dokument]
|
|
WHERE
|
|
[LC_Produkt_DokumentNr] = @iLC_Produkt_DokumentNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Dokument_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Produkt_Dokument'
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @blobDokument image
|
|
-- Returns: @iLC_Produkt_DokumentNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Dokument_Insert]
|
|
@iLC_ProduktNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sbeschreibung varchar(255),
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@blobDokument image,
|
|
@iLC_Produkt_DokumentNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[LC_Produkt_Dokument]
|
|
(
|
|
[LC_ProduktNr],
|
|
[Bezeichnung],
|
|
[beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Dokument]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLC_ProduktNr,
|
|
@sBezeichnung,
|
|
@sbeschreibung,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv,
|
|
@blobDokument
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iLC_Produkt_DokumentNr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Dokument_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Produkt_Dokument'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Dokument_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LC_Produkt_DokumentNr],
|
|
[LC_ProduktNr],
|
|
[Bezeichnung],
|
|
[beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Dokument]
|
|
FROM [dbo].[LC_Produkt_Dokument]
|
|
ORDER BY
|
|
[LC_Produkt_DokumentNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Dokument_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Produkt_Dokument'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLC_Produkt_DokumentNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Dokument_SelectOne]
|
|
@iLC_Produkt_DokumentNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LC_Produkt_DokumentNr],
|
|
[LC_ProduktNr],
|
|
[Bezeichnung],
|
|
[beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Dokument]
|
|
FROM [dbo].[LC_Produkt_Dokument]
|
|
WHERE
|
|
[LC_Produkt_DokumentNr] = @iLC_Produkt_DokumentNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Dokument_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Produkt_Dokument'
|
|
-- Gets: @iLC_Produkt_DokumentNr int
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @blobDokument image
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Dokument_Update]
|
|
@iLC_Produkt_DokumentNr int,
|
|
@iLC_ProduktNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sbeschreibung varchar(255),
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@blobDokument image,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[LC_Produkt_Dokument]
|
|
SET
|
|
[LC_ProduktNr] = @iLC_ProduktNr,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[beschreibung] = @sbeschreibung,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv,
|
|
[Dokument] = @blobDokument
|
|
WHERE
|
|
[LC_Produkt_DokumentNr] = @iLC_Produkt_DokumentNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Produkt'
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Gets: @iLC_ProduktNr_Parent int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @iImageindex int
|
|
-- Gets: @iProdukttypNr int
|
|
-- Gets: @blobImage image
|
|
-- Gets: @sVersion varchar(255)
|
|
-- Gets: @iStatusNr int
|
|
-- Gets: @daNächste_Ueberprüfung datetime
|
|
-- Gets: @daEntscheidungstermin datetime
|
|
-- Gets: @daAbgeloest_am datetime
|
|
-- Gets: @sAbgeloest_durch varchar(255)
|
|
-- Gets: @bIstStruktur bit
|
|
-- Gets: @iVerweisnr int
|
|
-- Gets: @sTerminBemerkung varchar(1024)
|
|
-- Gets: @iAbgeloest_durch_produktnr int
|
|
-- Gets: @iAbgeliest_durch_wen int
|
|
-- Gets: @sStatusbemerkung varchar(255)
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Insert]
|
|
@iLC_ProduktNr int,
|
|
@iLC_ProduktNr_Parent int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(1024),
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@iImageindex int,
|
|
@iProdukttypNr int,
|
|
@blobImage image,
|
|
@sVersion varchar(255),
|
|
@iStatusNr int,
|
|
@daNächste_Ueberprüfung datetime,
|
|
@daEntscheidungstermin datetime,
|
|
@daAbgeloest_am datetime,
|
|
@sAbgeloest_durch varchar(255),
|
|
@bIstStruktur bit,
|
|
@iVerweisnr int,
|
|
@sTerminBemerkung varchar(1024),
|
|
@iAbgeloest_durch_produktnr int,
|
|
@iAbgeliest_durch_wen int,
|
|
@sStatusbemerkung varchar(255),
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[LC_Produkt]
|
|
(
|
|
[LC_ProduktNr],
|
|
[LC_ProduktNr_Parent],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Imageindex],
|
|
[ProdukttypNr],
|
|
[Image],
|
|
[Version],
|
|
[StatusNr],
|
|
[Nächste_Ueberprüfung],
|
|
[Entscheidungstermin],
|
|
[Abgeloest_am],
|
|
[Abgeloest_durch],
|
|
[IstStruktur],
|
|
[Verweisnr],
|
|
[TerminBemerkung],
|
|
[Abgeloest_durch_produktnr],
|
|
[Abgeliest_durch_wen],
|
|
[Statusbemerkung],
|
|
[Sort]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLC_ProduktNr,
|
|
@iLC_ProduktNr_Parent,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv,
|
|
@iImageindex,
|
|
@iProdukttypNr,
|
|
@blobImage,
|
|
@sVersion,
|
|
@iStatusNr,
|
|
@daNächste_Ueberprüfung,
|
|
@daEntscheidungstermin,
|
|
@daAbgeloest_am,
|
|
@sAbgeloest_durch,
|
|
@bIstStruktur,
|
|
@iVerweisnr,
|
|
@sTerminBemerkung,
|
|
@iAbgeloest_durch_produktnr,
|
|
@iAbgeliest_durch_wen,
|
|
@sStatusbemerkung,
|
|
@iSort
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Phase_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Produkt_Phase'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLC_Produkt_PhaseNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Phase_Delete]
|
|
@iLC_Produkt_PhaseNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Produkt_Phase]
|
|
WHERE
|
|
[LC_Produkt_PhaseNr] = @iLC_Produkt_PhaseNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Phase_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Produkt_Phase'
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Gets: @iLC_PhaseNr int
|
|
-- Gets: @daDatum datetime
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iLC_Produkt_PhaseNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Phase_Insert]
|
|
@iLC_ProduktNr int,
|
|
@iLC_PhaseNr int,
|
|
@daDatum datetime,
|
|
@sBemerkung varchar(255),
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@iLC_Produkt_PhaseNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[LC_Produkt_Phase]
|
|
(
|
|
[LC_ProduktNr],
|
|
[LC_PhaseNr],
|
|
[Datum],
|
|
[Bemerkung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLC_ProduktNr,
|
|
@iLC_PhaseNr,
|
|
@daDatum,
|
|
@sBemerkung,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iLC_Produkt_PhaseNr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Phase_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Produkt_Phase'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Phase_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LC_Produkt_PhaseNr],
|
|
[LC_ProduktNr],
|
|
[LC_PhaseNr],
|
|
[Datum],
|
|
[Bemerkung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_Produkt_Phase]
|
|
ORDER BY
|
|
[LC_Produkt_PhaseNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Phase_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Produkt_Phase'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLC_Produkt_PhaseNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Phase_SelectOne]
|
|
@iLC_Produkt_PhaseNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LC_Produkt_PhaseNr],
|
|
[LC_ProduktNr],
|
|
[LC_PhaseNr],
|
|
[Datum],
|
|
[Bemerkung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_Produkt_Phase]
|
|
WHERE
|
|
[LC_Produkt_PhaseNr] = @iLC_Produkt_PhaseNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Phase_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Produkt_Phase'
|
|
-- Gets: @iLC_Produkt_PhaseNr int
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Gets: @iLC_PhaseNr int
|
|
-- Gets: @daDatum datetime
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Phase_Update]
|
|
@iLC_Produkt_PhaseNr int,
|
|
@iLC_ProduktNr int,
|
|
@iLC_PhaseNr int,
|
|
@daDatum datetime,
|
|
@sBemerkung 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_Produkt_Phase]
|
|
SET
|
|
[LC_ProduktNr] = @iLC_ProduktNr,
|
|
[LC_PhaseNr] = @iLC_PhaseNr,
|
|
[Datum] = @daDatum,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv
|
|
WHERE
|
|
[LC_Produkt_PhaseNr] = @iLC_Produkt_PhaseNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Produkt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LC_ProduktNr],
|
|
[LC_ProduktNr_Parent],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Imageindex],
|
|
[ProdukttypNr],
|
|
[Image],
|
|
[Version],
|
|
[StatusNr],
|
|
[Nächste_Ueberprüfung],
|
|
[Entscheidungstermin],
|
|
[Abgeloest_am],
|
|
[Abgeloest_durch],
|
|
[IstStruktur],
|
|
[Verweisnr],
|
|
[TerminBemerkung],
|
|
[Abgeloest_durch_produktnr],
|
|
[Abgeliest_durch_wen],
|
|
[Statusbemerkung],
|
|
[Sort]
|
|
FROM [dbo].[LC_Produkt]
|
|
ORDER BY
|
|
[LC_ProduktNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Produkt'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_SelectOne]
|
|
@iLC_ProduktNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LC_ProduktNr],
|
|
[LC_ProduktNr_Parent],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[Imageindex],
|
|
[ProdukttypNr],
|
|
[Image],
|
|
[Version],
|
|
[StatusNr],
|
|
[Nächste_Ueberprüfung],
|
|
[Entscheidungstermin],
|
|
[Abgeloest_am],
|
|
[Abgeloest_durch],
|
|
[IstStruktur],
|
|
[Verweisnr],
|
|
[TerminBemerkung],
|
|
[Abgeloest_durch_produktnr],
|
|
[Abgeliest_durch_wen],
|
|
[Statusbemerkung],
|
|
[Sort]
|
|
FROM [dbo].[LC_Produkt]
|
|
WHERE
|
|
[LC_ProduktNr] = @iLC_ProduktNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkt_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Produkt'
|
|
-- Gets: @iLC_ProduktNr int
|
|
-- Gets: @iLC_ProduktNr_Parent int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @iImageindex int
|
|
-- Gets: @iProdukttypNr int
|
|
-- Gets: @blobImage image
|
|
-- Gets: @sVersion varchar(255)
|
|
-- Gets: @iStatusNr int
|
|
-- Gets: @daNächste_Ueberprüfung datetime
|
|
-- Gets: @daEntscheidungstermin datetime
|
|
-- Gets: @daAbgeloest_am datetime
|
|
-- Gets: @sAbgeloest_durch varchar(255)
|
|
-- Gets: @bIstStruktur bit
|
|
-- Gets: @iVerweisnr int
|
|
-- Gets: @sTerminBemerkung varchar(1024)
|
|
-- Gets: @iAbgeloest_durch_produktnr int
|
|
-- Gets: @iAbgeliest_durch_wen int
|
|
-- Gets: @sStatusbemerkung varchar(255)
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkt_Update]
|
|
@iLC_ProduktNr int,
|
|
@iLC_ProduktNr_Parent int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(1024),
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@iImageindex int,
|
|
@iProdukttypNr int,
|
|
@blobImage image,
|
|
@sVersion varchar(255),
|
|
@iStatusNr int,
|
|
@daNächste_Ueberprüfung datetime,
|
|
@daEntscheidungstermin datetime,
|
|
@daAbgeloest_am datetime,
|
|
@sAbgeloest_durch varchar(255),
|
|
@bIstStruktur bit,
|
|
@iVerweisnr int,
|
|
@sTerminBemerkung varchar(1024),
|
|
@iAbgeloest_durch_produktnr int,
|
|
@iAbgeliest_durch_wen int,
|
|
@sStatusbemerkung varchar(255),
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[LC_Produkt]
|
|
SET
|
|
[LC_ProduktNr_Parent] = @iLC_ProduktNr_Parent,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv,
|
|
[Imageindex] = @iImageindex,
|
|
[ProdukttypNr] = @iProdukttypNr,
|
|
[Image] = @blobImage,
|
|
[Version] = @sVersion,
|
|
[StatusNr] = @iStatusNr,
|
|
[Nächste_Ueberprüfung] = @daNächste_Ueberprüfung,
|
|
[Entscheidungstermin] = @daEntscheidungstermin,
|
|
[Abgeloest_am] = @daAbgeloest_am,
|
|
[Abgeloest_durch] = @sAbgeloest_durch,
|
|
[IstStruktur] = @bIstStruktur,
|
|
[Verweisnr] = @iVerweisnr,
|
|
[TerminBemerkung] = @sTerminBemerkung,
|
|
[Abgeloest_durch_produktnr] = @iAbgeloest_durch_produktnr,
|
|
[Abgeliest_durch_wen] = @iAbgeliest_durch_wen,
|
|
[Statusbemerkung] = @sStatusbemerkung,
|
|
[Sort] = @iSort
|
|
WHERE
|
|
[LC_ProduktNr] = @iLC_ProduktNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkttyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_Produkttyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLC_Produkttypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkttyp_Delete]
|
|
@iLC_Produkttypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_Produkttyp]
|
|
WHERE
|
|
[LC_Produkttypnr] = @iLC_Produkttypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkttyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_Produkttyp'
|
|
-- Gets: @iLC_Produkttypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkttyp_Insert]
|
|
@iLC_Produkttypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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_Produkttyp]
|
|
(
|
|
[LC_Produkttypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLC_Produkttypnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkttyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_Produkttyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkttyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LC_Produkttypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_Produkttyp]
|
|
ORDER BY
|
|
[LC_Produkttypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkttyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_Produkttyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLC_Produkttypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkttyp_SelectOne]
|
|
@iLC_Produkttypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LC_Produkttypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_Produkttyp]
|
|
WHERE
|
|
[LC_Produkttypnr] = @iLC_Produkttypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_Produkttyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_Produkttyp'
|
|
-- Gets: @iLC_Produkttypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_Produkttyp_Update]
|
|
@iLC_Produkttypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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_Produkttyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv
|
|
WHERE
|
|
[LC_Produkttypnr] = @iLC_Produkttypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_SQL_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LC_SQL'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLC_SQLNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_SQL_Delete]
|
|
@iLC_SQLNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LC_SQL]
|
|
WHERE
|
|
[LC_SQLNr] = @iLC_SQLNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_SQL_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LC_SQL'
|
|
-- Gets: @iLC_SQLNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_SQL_Insert]
|
|
@iLC_SQLNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(1024),
|
|
@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_SQL]
|
|
(
|
|
[LC_SQLNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLC_SQLNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_SQL_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LC_SQL'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_SQL_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LC_SQLNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_SQL]
|
|
ORDER BY
|
|
[LC_SQLNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_SQL_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LC_SQL'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLC_SQLNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_SQL_SelectOne]
|
|
@iLC_SQLNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LC_SQLNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[LC_SQL]
|
|
WHERE
|
|
[LC_SQLNr] = @iLC_SQLNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LC_SQL_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LC_SQL'
|
|
-- Gets: @iLC_SQLNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LC_SQL_Update]
|
|
@iLC_SQLNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(1024),
|
|
@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_SQL]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv
|
|
WHERE
|
|
[LC_SQLNr] = @iLC_SQLNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LinkList_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LinkList'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLinkNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LinkList_Delete]
|
|
@iLinkNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LinkList]
|
|
WHERE
|
|
[LinkNr] = @iLinkNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LinkList_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LinkList'
|
|
-- Gets: @iLinkNr int
|
|
-- Gets: @sBezeichnung varchar(1024)
|
|
-- 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_LinkList_Insert]
|
|
@iLinkNr int,
|
|
@sBezeichnung varchar(1024),
|
|
@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].[LinkList]
|
|
(
|
|
[LinkNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLinkNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LinkList_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LinkList'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LinkList_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LinkNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[LinkList]
|
|
ORDER BY
|
|
[LinkNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LinkList_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LinkList'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLinkNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LinkList_SelectOne]
|
|
@iLinkNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LinkNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[LinkList]
|
|
WHERE
|
|
[LinkNr] = @iLinkNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LinkList_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LinkList'
|
|
-- Gets: @iLinkNr int
|
|
-- Gets: @sBezeichnung varchar(1024)
|
|
-- 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_LinkList_Update]
|
|
@iLinkNr int,
|
|
@sBezeichnung varchar(1024),
|
|
@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].[LinkList]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[LinkNr] = @iLinkNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenz_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Lizenz'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLizenzNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenz_Delete]
|
|
@iLizenzNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Lizenz]
|
|
WHERE
|
|
[LizenzNr] = @iLizenzNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenz_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Lizenz'
|
|
-- Gets: @iLizenzNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @iVertragselementApplikationnr int
|
|
-- Gets: @bStrukturelement bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenz_Insert]
|
|
@iLizenzNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(1024),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSecurityLevelNr int,
|
|
@iParentID int,
|
|
@iVertragselementApplikationnr int,
|
|
@bStrukturelement bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Lizenz]
|
|
(
|
|
[LizenzNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr],
|
|
[ParentID],
|
|
[VertragselementApplikationnr],
|
|
[Strukturelement]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLizenzNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iSecurityLevelNr,
|
|
@iParentID,
|
|
@iVertragselementApplikationnr,
|
|
@bStrukturelement
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenz_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenz'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenz_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LizenzNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr],
|
|
[ParentID],
|
|
[VertragselementApplikationnr],
|
|
[Strukturelement]
|
|
FROM [dbo].[Lizenz]
|
|
ORDER BY
|
|
[LizenzNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenz_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Lizenz'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLizenzNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenz_SelectOne]
|
|
@iLizenzNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LizenzNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[SecurityLevelNr],
|
|
[ParentID],
|
|
[VertragselementApplikationnr],
|
|
[Strukturelement]
|
|
FROM [dbo].[Lizenz]
|
|
WHERE
|
|
[LizenzNr] = @iLizenzNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenz_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Lizenz'
|
|
-- Gets: @iLizenzNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @iVertragselementApplikationnr int
|
|
-- Gets: @bStrukturelement bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenz_Update]
|
|
@iLizenzNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(1024),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSecurityLevelNr int,
|
|
@iParentID int,
|
|
@iVertragselementApplikationnr int,
|
|
@bStrukturelement bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Lizenz]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[ParentID] = @iParentID,
|
|
[VertragselementApplikationnr] = @iVertragselementApplikationnr,
|
|
[Strukturelement] = @bStrukturelement
|
|
WHERE
|
|
[LizenzNr] = @iLizenzNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Lizenzkauf'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLizenzkaufNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_Delete]
|
|
@iLizenzkaufNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Lizenzkauf]
|
|
WHERE
|
|
[LizenzkaufNr] = @iLizenzkaufNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_DeleteAllWVertragselementapplikationnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Lizenzkauf'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragselementapplikationnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_DeleteAllWVertragselementapplikationnrLogic]
|
|
@iVertragselementapplikationnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Lizenzkauf]
|
|
WHERE
|
|
[Vertragselementapplikationnr] = @iVertragselementapplikationnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Lizenzkauf'
|
|
-- Gets: @iLizenzkaufNr int
|
|
-- Gets: @iVertragselementapplikationnr int
|
|
-- Gets: @iAnzahl int
|
|
-- Gets: @daKaufdatum datetime
|
|
-- Gets: @sKGNummer varchar(50)
|
|
-- Gets: @sSAPNummer varchar(50)
|
|
-- Gets: @daGueltigbis datetime
|
|
-- Gets: @iStatusnr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iLizenztypnr int
|
|
-- Gets: @iLizenznr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_Insert]
|
|
@iLizenzkaufNr int,
|
|
@iVertragselementapplikationnr int,
|
|
@iAnzahl int,
|
|
@daKaufdatum datetime,
|
|
@sKGNummer varchar(50),
|
|
@sSAPNummer varchar(50),
|
|
@daGueltigbis datetime,
|
|
@iStatusnr int,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iLizenztypnr int,
|
|
@iLizenznr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Lizenzkauf]
|
|
(
|
|
[LizenzkaufNr],
|
|
[Vertragselementapplikationnr],
|
|
[Anzahl],
|
|
[Kaufdatum],
|
|
[KGNummer],
|
|
[SAPNummer],
|
|
[Gueltigbis],
|
|
[Statusnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Lizenztypnr],
|
|
[Lizenznr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLizenzkaufNr,
|
|
@iVertragselementapplikationnr,
|
|
@iAnzahl,
|
|
@daKaufdatum,
|
|
@sKGNummer,
|
|
@sSAPNummer,
|
|
@daGueltigbis,
|
|
@iStatusnr,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iLizenztypnr,
|
|
@iLizenznr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzkauf'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LizenzkaufNr],
|
|
[Vertragselementapplikationnr],
|
|
[Anzahl],
|
|
[Kaufdatum],
|
|
[KGNummer],
|
|
[SAPNummer],
|
|
[Gueltigbis],
|
|
[Statusnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Lizenztypnr],
|
|
[Lizenznr]
|
|
FROM [dbo].[Lizenzkauf]
|
|
ORDER BY
|
|
[LizenzkaufNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzkauf'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
if @fokus=0 begin
|
|
SELECT
|
|
[LizenzkaufNr],
|
|
[Vertragselementapplikationnr],
|
|
[Anzahl],
|
|
[Kaufdatum],
|
|
[KGNummer],
|
|
[SAPNummer],
|
|
[Gueltigbis],
|
|
[Statusnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Lizenztypnr],
|
|
[Lizenznr]
|
|
FROM [dbo].[Lizenzkauf]
|
|
where Lizenznr=@keyvalue
|
|
ORDER BY
|
|
[LizenzkaufNr] ASC
|
|
end else begin
|
|
select 1
|
|
--SELECT
|
|
-- [LizenzkaufNr],
|
|
-- dbo.Lizenzkauf.[Vertragselementnr],
|
|
-- [Anzahl],
|
|
-- [Kaufdatum],
|
|
-- [KGNummer],
|
|
-- [SAPNummer],
|
|
-- [Gueltigbis],
|
|
-- [Statusnr],
|
|
-- dbo.Lizenzkauf.[Bemerkung],
|
|
-- dbo.Lizenzkauf.[Aktiv],
|
|
-- dbo.Lizenzkauf.[Erstellt_am],
|
|
-- dbo.Lizenzkauf.[Mutiert_am],
|
|
-- dbo.Lizenzkauf.[Mutierer]
|
|
|
|
--FROM dbo.Lizenzkauf INNER JOIN
|
|
-- dbo.Vertragselement ON dbo.Lizenzkauf.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
-- dbo.VertragselementApplikation ON dbo.Vertragselement.Vertragselementnr = dbo.VertragselementApplikation.Vertragselementnr
|
|
--where dbo.VertragselementApplikation.applikationnr=@keyvalue
|
|
end
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_SelectAllWVertragselementapplikationnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Lizenzkauf'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragselementapplikationnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_SelectAllWVertragselementapplikationnrLogic]
|
|
@iVertragselementapplikationnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[LizenzkaufNr],
|
|
[Vertragselementapplikationnr],
|
|
[Anzahl],
|
|
[Kaufdatum],
|
|
[KGNummer],
|
|
[SAPNummer],
|
|
[Gueltigbis],
|
|
[Statusnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Lizenztypnr]
|
|
FROM [dbo].[Lizenzkauf]
|
|
WHERE
|
|
[Vertragselementapplikationnr] = @iVertragselementapplikationnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Lizenzkauf'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLizenzkaufNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_SelectOne]
|
|
@iLizenzkaufNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LizenzkaufNr],
|
|
[Vertragselementapplikationnr],
|
|
[Anzahl],
|
|
[Kaufdatum],
|
|
[KGNummer],
|
|
[SAPNummer],
|
|
[Gueltigbis],
|
|
[Statusnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Lizenztypnr],
|
|
[Lizenznr]
|
|
FROM [dbo].[Lizenzkauf]
|
|
WHERE
|
|
[LizenzkaufNr] = @iLizenzkaufNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Lizenzkauf'
|
|
-- Gets: @iLizenzkaufNr int
|
|
-- Gets: @iVertragselementapplikationnr int
|
|
-- Gets: @iAnzahl int
|
|
-- Gets: @daKaufdatum datetime
|
|
-- Gets: @sKGNummer varchar(50)
|
|
-- Gets: @sSAPNummer varchar(50)
|
|
-- Gets: @daGueltigbis datetime
|
|
-- Gets: @iStatusnr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iLizenztypnr int
|
|
-- Gets: @iLizenznr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_Update]
|
|
@iLizenzkaufNr int,
|
|
@iVertragselementapplikationnr int,
|
|
@iAnzahl int,
|
|
@daKaufdatum datetime,
|
|
@sKGNummer varchar(50),
|
|
@sSAPNummer varchar(50),
|
|
@daGueltigbis datetime,
|
|
@iStatusnr int,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iLizenztypnr int,
|
|
@iLizenznr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Lizenzkauf]
|
|
SET
|
|
[Vertragselementapplikationnr] = @iVertragselementapplikationnr,
|
|
[Anzahl] = @iAnzahl,
|
|
[Kaufdatum] = @daKaufdatum,
|
|
[KGNummer] = @sKGNummer,
|
|
[SAPNummer] = @sSAPNummer,
|
|
[Gueltigbis] = @daGueltigbis,
|
|
[Statusnr] = @iStatusnr,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Lizenztypnr] = @iLizenztypnr,
|
|
[Lizenznr] = @iLizenznr
|
|
WHERE
|
|
[LizenzkaufNr] = @iLizenzkaufNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzkauf_UpdateAllWVertragselementapplikationnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Lizenzkauf'.
|
|
-- Will reset field [Vertragselementapplikationnr] with value @iVertragselementapplikationnrOld to value @iVertragselementapplikationnr
|
|
-- Gets: @iVertragselementapplikationnr int
|
|
-- Gets: @iVertragselementapplikationnrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzkauf_UpdateAllWVertragselementapplikationnrLogic]
|
|
@iVertragselementapplikationnr int,
|
|
@iVertragselementapplikationnrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Lizenzkauf]
|
|
SET
|
|
[Vertragselementapplikationnr] = @iVertragselementapplikationnr
|
|
WHERE
|
|
[Vertragselementapplikationnr] = @iVertragselementapplikationnrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Lizenzschluessel'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLizenzschluesselnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_Delete]
|
|
@iLizenzschluesselnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Lizenzschluessel]
|
|
WHERE
|
|
[Lizenzschluesselnr] = @iLizenzschluesselnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_DeleteAllWLizenzkaufnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Lizenzschluessel'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iLizenzkaufnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_DeleteAllWLizenzkaufnrLogic]
|
|
@iLizenzkaufnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Lizenzschluessel]
|
|
WHERE
|
|
[Lizenzkaufnr] = @iLizenzkaufnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Lizenzschluessel'
|
|
-- Gets: @iLizenzschluesselnr int
|
|
-- Gets: @iLizenzkaufnr int
|
|
-- Gets: @sLizenzschluessel varchar(255)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_Insert]
|
|
@iLizenzschluesselnr int,
|
|
@iLizenzkaufnr int,
|
|
@sLizenzschluessel varchar(255),
|
|
@sBemerkung 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].[Lizenzschluessel]
|
|
(
|
|
[Lizenzschluesselnr],
|
|
[Lizenzkaufnr],
|
|
[Lizenzschluessel],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLizenzschluesselnr,
|
|
@iLizenzkaufnr,
|
|
@sLizenzschluessel,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzschluessel'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Lizenzschluesselnr],
|
|
[Lizenzkaufnr],
|
|
[Lizenzschluessel],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Lizenzschluessel]
|
|
ORDER BY
|
|
[Lizenzschluesselnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzschluessel'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_Lizenzschluessel_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Lizenzschluesselnr],
|
|
[Lizenzkaufnr],
|
|
[Lizenzschluessel],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Lizenzschluessel]
|
|
where lizenzkaufnr=@keyvalue
|
|
ORDER BY
|
|
[Lizenzschluesselnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_SelectAllWLizenzkaufnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Lizenzschluessel'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iLizenzkaufnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_SelectAllWLizenzkaufnrLogic]
|
|
@iLizenzkaufnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[Lizenzschluesselnr],
|
|
[Lizenzkaufnr],
|
|
[Lizenzschluessel],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Lizenzschluessel]
|
|
WHERE
|
|
[Lizenzkaufnr] = @iLizenzkaufnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Lizenzschluessel'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLizenzschluesselnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_SelectOne]
|
|
@iLizenzschluesselnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Lizenzschluesselnr],
|
|
[Lizenzkaufnr],
|
|
[Lizenzschluessel],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Lizenzschluessel]
|
|
WHERE
|
|
[Lizenzschluesselnr] = @iLizenzschluesselnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Lizenzschluessel'
|
|
-- Gets: @iLizenzschluesselnr int
|
|
-- Gets: @iLizenzkaufnr int
|
|
-- Gets: @sLizenzschluessel varchar(255)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_Update]
|
|
@iLizenzschluesselnr int,
|
|
@iLizenzkaufnr int,
|
|
@sLizenzschluessel varchar(255),
|
|
@sBemerkung 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].[Lizenzschluessel]
|
|
SET
|
|
[Lizenzkaufnr] = @iLizenzkaufnr,
|
|
[Lizenzschluessel] = @sLizenzschluessel,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Lizenzschluesselnr] = @iLizenzschluesselnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenzschluessel_UpdateAllWLizenzkaufnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Lizenzschluessel'.
|
|
-- Will reset field [Lizenzkaufnr] with value @iLizenzkaufnrOld to value @iLizenzkaufnr
|
|
-- Gets: @iLizenzkaufnr int
|
|
-- Gets: @iLizenzkaufnrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenzschluessel_UpdateAllWLizenzkaufnrLogic]
|
|
@iLizenzkaufnr int,
|
|
@iLizenzkaufnrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Lizenzschluessel]
|
|
SET
|
|
[Lizenzkaufnr] = @iLizenzkaufnr
|
|
WHERE
|
|
[Lizenzkaufnr] = @iLizenzkaufnrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenztyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Lizenztyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLizenztypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenztyp_Delete]
|
|
@iLizenztypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Lizenztyp]
|
|
WHERE
|
|
[Lizenztypnr] = @iLizenztypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenztyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Lizenztyp'
|
|
-- Gets: @iLizenztypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenztyp_Insert]
|
|
@iLizenztypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Lizenztyp]
|
|
(
|
|
[Lizenztypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLizenztypnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenztyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenztyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_Lizenztyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Lizenztypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Lizenztyp]
|
|
ORDER BY
|
|
[Bezeichnung] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenztyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Lizenztyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLizenztypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenztyp_SelectOne]
|
|
@iLizenztypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Lizenztypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Lizenztyp]
|
|
WHERE
|
|
[Lizenztypnr] = @iLizenztypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Lizenztyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Lizenztyp'
|
|
-- Gets: @iLizenztypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Lizenztyp_Update]
|
|
@iLizenztypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Lizenztyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Lizenztypnr] = @iLizenztypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LizenzVertragselementApplikation_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'LizenzVertragselementApplikation'
|
|
-- using the Primary Key.
|
|
-- Gets: @iLizenzVEApplNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LizenzVertragselementApplikation_Delete]
|
|
@iLizenzVEApplNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[LizenzVertragselementApplikation]
|
|
WHERE
|
|
[LizenzVEApplNr] = @iLizenzVEApplNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LizenzVertragselementApplikation_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'LizenzVertragselementApplikation'
|
|
-- Gets: @iLizenzVEApplNr int
|
|
-- Gets: @iLizenznr int
|
|
-- Gets: @iVertragselementApplikationNr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LizenzVertragselementApplikation_Insert]
|
|
@iLizenzVEApplNr int,
|
|
@iLizenznr int,
|
|
@iVertragselementApplikationNr int,
|
|
@sBemerkung 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].[LizenzVertragselementApplikation]
|
|
(
|
|
[LizenzVEApplNr],
|
|
[Lizenznr],
|
|
[VertragselementApplikationNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iLizenzVEApplNr,
|
|
@iLizenznr,
|
|
@iVertragselementApplikationNr,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LizenzVertragselementApplikation_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'LizenzVertragselementApplikation'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LizenzVertragselementApplikation_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[LizenzVEApplNr],
|
|
[Lizenznr],
|
|
[VertragselementApplikationNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[LizenzVertragselementApplikation]
|
|
ORDER BY
|
|
[LizenzVEApplNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LizenzVertragselementApplikation_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'LizenzVertragselementApplikation'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iLizenzVEApplNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LizenzVertragselementApplikation_SelectOne]
|
|
@iLizenzVEApplNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[LizenzVEApplNr],
|
|
[Lizenznr],
|
|
[VertragselementApplikationNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[LizenzVertragselementApplikation]
|
|
WHERE
|
|
[LizenzVEApplNr] = @iLizenzVEApplNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_LizenzVertragselementApplikation_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'LizenzVertragselementApplikation'
|
|
-- Gets: @iLizenzVEApplNr int
|
|
-- Gets: @iLizenznr int
|
|
-- Gets: @iVertragselementApplikationNr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_LizenzVertragselementApplikation_Update]
|
|
@iLizenzVEApplNr int,
|
|
@iLizenznr int,
|
|
@iVertragselementApplikationNr int,
|
|
@sBemerkung 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].[LizenzVertragselementApplikation]
|
|
SET
|
|
[Lizenznr] = @iLizenznr,
|
|
[VertragselementApplikationNr] = @iVertragselementApplikationNr,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[LizenzVEApplNr] = @iLizenzVEApplNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MA_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'MA'
|
|
-- using the Primary Key.
|
|
-- Gets: @iMANr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MA_Delete]
|
|
@iMANr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[MA]
|
|
WHERE
|
|
[MANr] = @iMANr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MA_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'MA'
|
|
-- Gets: @iMANr int
|
|
-- Gets: @sName varchar(50)
|
|
-- Gets: @sVorname varchar(50)
|
|
-- Gets: @sTGNummer varchar(50)
|
|
-- Gets: @sKurzzeichen varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @daGueltig_bis datetime
|
|
-- Gets: @iSortierung int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MA_Insert]
|
|
@iMANr int,
|
|
@sName varchar(50),
|
|
@sVorname varchar(50),
|
|
@sTGNummer varchar(50),
|
|
@sKurzzeichen varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@daGueltig_bis datetime,
|
|
@iSortierung int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[MA]
|
|
(
|
|
[MANr],
|
|
[Name],
|
|
[Vorname],
|
|
[TGNummer],
|
|
[Kurzzeichen],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Gueltig_bis],
|
|
[Sortierung]
|
|
)
|
|
VALUES
|
|
(
|
|
@iMANr,
|
|
@sName,
|
|
@sVorname,
|
|
@sTGNummer,
|
|
@sKurzzeichen,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@daGueltig_bis,
|
|
@iSortierung
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MA_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'MA'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MA_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[MANr],
|
|
[Name],
|
|
[Vorname],
|
|
[TGNummer],
|
|
[Kurzzeichen],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Gueltig_bis],
|
|
[Sortierung]
|
|
FROM [dbo].[MA]
|
|
ORDER BY
|
|
[MANr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MA_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'MA'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iMANr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MA_SelectOne]
|
|
@iMANr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[MANr],
|
|
[Name],
|
|
[Vorname],
|
|
[TGNummer],
|
|
[Kurzzeichen],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Gueltig_bis],
|
|
[Sortierung]
|
|
FROM [dbo].[MA]
|
|
WHERE
|
|
[MANr] = @iMANr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MA_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'MA'
|
|
-- Gets: @iMANr int
|
|
-- Gets: @sName varchar(50)
|
|
-- Gets: @sVorname varchar(50)
|
|
-- Gets: @sTGNummer varchar(50)
|
|
-- Gets: @sKurzzeichen varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @daGueltig_bis datetime
|
|
-- Gets: @iSortierung int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MA_Update]
|
|
@iMANr int,
|
|
@sName varchar(50),
|
|
@sVorname varchar(50),
|
|
@sTGNummer varchar(50),
|
|
@sKurzzeichen varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@daGueltig_bis datetime,
|
|
@iSortierung int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[MA]
|
|
SET
|
|
[Name] = @sName,
|
|
[Vorname] = @sVorname,
|
|
[TGNummer] = @sTGNummer,
|
|
[Kurzzeichen] = @sKurzzeichen,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Gueltig_bis] = @daGueltig_bis,
|
|
[Sortierung] = @iSortierung
|
|
WHERE
|
|
[MANr] = @iMANr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MADetails_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'MADetails'
|
|
-- using the Primary Key.
|
|
-- Gets: @iMADetailNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MADetails_Delete]
|
|
@iMADetailNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[MADetails]
|
|
WHERE
|
|
[MADetailNr] = @iMADetailNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MADetails_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'MADetails'
|
|
-- Gets: @iMADetailNr int
|
|
-- Gets: @iMANr int
|
|
-- Gets: @iMitarbeiterTypNr int
|
|
-- Gets: @iOENr int
|
|
-- Gets: @iEngagement int
|
|
-- Gets: @daGueltig_ab datetime
|
|
-- Gets: @sBemerkung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iIndividuelle_Reduktion int
|
|
-- Gets: @sIndividuelle_Reduktion_Bemerkung varchar(1024)
|
|
-- Gets: @iPlanwert_Anteil_RTB_Person int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MADetails_Insert]
|
|
@iMADetailNr int,
|
|
@iMANr int,
|
|
@iMitarbeiterTypNr int,
|
|
@iOENr int,
|
|
@iEngagement int,
|
|
@daGueltig_ab datetime,
|
|
@sBemerkung varchar(1024),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iIndividuelle_Reduktion int,
|
|
@sIndividuelle_Reduktion_Bemerkung varchar(1024),
|
|
@iPlanwert_Anteil_RTB_Person int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[MADetails]
|
|
(
|
|
[MADetailNr],
|
|
[MANr],
|
|
[MitarbeiterTypNr],
|
|
[OENr],
|
|
[Engagement],
|
|
[Gueltig_ab],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Individuelle_Reduktion],
|
|
[Individuelle_Reduktion_Bemerkung],
|
|
[Planwert_Anteil_RTB_Person]
|
|
)
|
|
VALUES
|
|
(
|
|
@iMADetailNr,
|
|
@iMANr,
|
|
@iMitarbeiterTypNr,
|
|
@iOENr,
|
|
@iEngagement,
|
|
@daGueltig_ab,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iIndividuelle_Reduktion,
|
|
@sIndividuelle_Reduktion_Bemerkung,
|
|
@iPlanwert_Anteil_RTB_Person
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MADetails_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'MADetails'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MADetails_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[MADetailNr],
|
|
[MANr],
|
|
[MitarbeiterTypNr],
|
|
[OENr],
|
|
[Engagement],
|
|
[Gueltig_ab],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Individuelle_Reduktion],
|
|
[Individuelle_Reduktion_Bemerkung],
|
|
[Planwert_Anteil_RTB_Person]
|
|
FROM [dbo].[MADetails]
|
|
ORDER BY
|
|
[MADetailNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MADetails_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'MADetails'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iMADetailNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MADetails_SelectOne]
|
|
@iMADetailNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[MADetailNr],
|
|
[MANr],
|
|
[MitarbeiterTypNr],
|
|
[OENr],
|
|
[Engagement],
|
|
[Gueltig_ab],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Individuelle_Reduktion],
|
|
[Individuelle_Reduktion_Bemerkung],
|
|
[Planwert_Anteil_RTB_Person]
|
|
FROM [dbo].[MADetails]
|
|
WHERE
|
|
[MADetailNr] = @iMADetailNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MADetails_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'MADetails'
|
|
-- Gets: @iMADetailNr int
|
|
-- Gets: @iMANr int
|
|
-- Gets: @iMitarbeiterTypNr int
|
|
-- Gets: @iOENr int
|
|
-- Gets: @iEngagement int
|
|
-- Gets: @daGueltig_ab datetime
|
|
-- Gets: @sBemerkung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iIndividuelle_Reduktion int
|
|
-- Gets: @sIndividuelle_Reduktion_Bemerkung varchar(1024)
|
|
-- Gets: @iPlanwert_Anteil_RTB_Person int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MADetails_Update]
|
|
@iMADetailNr int,
|
|
@iMANr int,
|
|
@iMitarbeiterTypNr int,
|
|
@iOENr int,
|
|
@iEngagement int,
|
|
@daGueltig_ab datetime,
|
|
@sBemerkung varchar(1024),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iIndividuelle_Reduktion int,
|
|
@sIndividuelle_Reduktion_Bemerkung varchar(1024),
|
|
@iPlanwert_Anteil_RTB_Person int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[MADetails]
|
|
SET
|
|
[MANr] = @iMANr,
|
|
[MitarbeiterTypNr] = @iMitarbeiterTypNr,
|
|
[OENr] = @iOENr,
|
|
[Engagement] = @iEngagement,
|
|
[Gueltig_ab] = @daGueltig_ab,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Individuelle_Reduktion] = @iIndividuelle_Reduktion,
|
|
[Individuelle_Reduktion_Bemerkung] = @sIndividuelle_Reduktion_Bemerkung,
|
|
[Planwert_Anteil_RTB_Person] = @iPlanwert_Anteil_RTB_Person
|
|
WHERE
|
|
[MADetailNr] = @iMADetailNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mandant_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'mandant'
|
|
-- using the Primary Key.
|
|
-- Gets: @imandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mandant_Delete]
|
|
@imandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[mandant]
|
|
WHERE
|
|
[mandantnr] = @imandantnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mandant_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'mandant'
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @sbezeichnung varchar(255)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @imandantnr1 int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mandant_Insert]
|
|
@imandantnr int,
|
|
@sbezeichnung varchar(255),
|
|
@sbeschreibung varchar(255),
|
|
@imandantnr1 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].[mandant]
|
|
(
|
|
[mandantnr],
|
|
[bezeichnung],
|
|
[beschreibung],
|
|
[mandantnr1],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@imandantnr,
|
|
@sbezeichnung,
|
|
@sbeschreibung,
|
|
@imandantnr1,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mandant_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'mandant'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mandant_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[mandantnr],
|
|
[bezeichnung],
|
|
[beschreibung],
|
|
[mandantnr1],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[mandant]
|
|
ORDER BY
|
|
[mandantnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mandant_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'mandant'
|
|
-- based on the Primary Key.
|
|
-- Gets: @imandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mandant_SelectOne]
|
|
@imandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[mandantnr],
|
|
[bezeichnung],
|
|
[beschreibung],
|
|
[mandantnr1],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[mandant]
|
|
WHERE
|
|
[mandantnr] = @imandantnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mandant_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'mandant'
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @sbezeichnung varchar(255)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @imandantnr1 int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mandant_Update]
|
|
@imandantnr int,
|
|
@sbezeichnung varchar(255),
|
|
@sbeschreibung varchar(255),
|
|
@imandantnr1 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].[mandant]
|
|
SET
|
|
[bezeichnung] = @sbezeichnung,
|
|
[beschreibung] = @sbeschreibung,
|
|
[mandantnr1] = @imandantnr1,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer
|
|
WHERE
|
|
[mandantnr] = @imandantnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Marktbereich_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Marktbereich'
|
|
-- using the Primary Key.
|
|
-- Gets: @iMarktbereichNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Marktbereich_Delete]
|
|
@iMarktbereichNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Marktbereich]
|
|
WHERE
|
|
[MarktbereichNr] = @iMarktbereichNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Marktbereich_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Marktbereich'
|
|
-- Gets: @iMarktbereichNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Marktbereich_Insert]
|
|
@iMarktbereichNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Marktbereich]
|
|
(
|
|
[MarktbereichNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iMarktbereichNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Marktbereich_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Marktbereich'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Marktbereich_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[MarktbereichNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Marktbereich]
|
|
ORDER BY
|
|
[MarktbereichNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Marktbereich_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Marktbereich'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iMarktbereichNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Marktbereich_SelectOne]
|
|
@iMarktbereichNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[MarktbereichNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Marktbereich]
|
|
WHERE
|
|
[MarktbereichNr] = @iMarktbereichNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Marktbereich_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Marktbereich'
|
|
-- Gets: @iMarktbereichNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Marktbereich_Update]
|
|
@iMarktbereichNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[Marktbereich]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[MarktbereichNr] = @iMarktbereichNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_meldungstexte_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'meldungstexte'
|
|
-- using the Primary Key.
|
|
-- Gets: @imeldungstextnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_meldungstexte_Delete]
|
|
@imeldungstextnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[meldungstexte]
|
|
WHERE
|
|
[meldungstextnr] = @imeldungstextnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_meldungstexte_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'meldungstexte'
|
|
-- Gets: @imeldungstextnr int
|
|
-- Gets: @isprache int
|
|
-- Gets: @sinhalt varchar(1024)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @imandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_meldungstexte_Insert]
|
|
@imeldungstextnr int,
|
|
@isprache int,
|
|
@sinhalt varchar(1024),
|
|
@sBeschreibung varchar(255),
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@imandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[meldungstexte]
|
|
(
|
|
[meldungstextnr],
|
|
[sprache],
|
|
[inhalt],
|
|
[Beschreibung],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@imeldungstextnr,
|
|
@isprache,
|
|
@sinhalt,
|
|
@sBeschreibung,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@imandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_meldungstexte_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'meldungstexte'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_meldungstexte_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[meldungstextnr],
|
|
[sprache],
|
|
[inhalt],
|
|
[Beschreibung],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr]
|
|
FROM [dbo].[meldungstexte]
|
|
ORDER BY
|
|
[meldungstextnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_meldungstexte_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'meldungstexte'
|
|
-- based on the Primary Key.
|
|
-- Gets: @imeldungstextnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_meldungstexte_SelectOne]
|
|
@imeldungstextnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[meldungstextnr],
|
|
[sprache],
|
|
[inhalt],
|
|
[Beschreibung],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr]
|
|
FROM [dbo].[meldungstexte]
|
|
WHERE
|
|
[meldungstextnr] = @imeldungstextnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_meldungstexte_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'meldungstexte'
|
|
-- Gets: @imeldungstextnr int
|
|
-- Gets: @isprache int
|
|
-- Gets: @sinhalt varchar(1024)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @imandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_meldungstexte_Update]
|
|
@imeldungstextnr int,
|
|
@isprache int,
|
|
@sinhalt varchar(1024),
|
|
@sBeschreibung varchar(255),
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@imandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[meldungstexte]
|
|
SET
|
|
[sprache] = @isprache,
|
|
[inhalt] = @sinhalt,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[mandantnr] = @imandantnr
|
|
WHERE
|
|
[meldungstextnr] = @imeldungstextnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeiter_Auswertungsparameter_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Mitarbeiter_Auswertungsparameter'
|
|
-- using the Primary Key.
|
|
-- Gets: @iMitarbeiter_AuswertungsparameterNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeiter_Auswertungsparameter_Delete]
|
|
@iMitarbeiter_AuswertungsparameterNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Mitarbeiter_Auswertungsparameter]
|
|
WHERE
|
|
[Mitarbeiter_AuswertungsparameterNr] = @iMitarbeiter_AuswertungsparameterNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeiter_Auswertungsparameter_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Mitarbeiter_Auswertungsparameter'
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Gets: @iAuswertungnr int
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @sParameterdaten varchar(1024)
|
|
-- Gets: @sTitelzeile1 varchar(255)
|
|
-- Gets: @sTitelzeile2 varchar(255)
|
|
-- Gets: @bParamPrint bit
|
|
-- Gets: @sSQLWhere varchar(1024)
|
|
-- Returns: @iMitarbeiter_AuswertungsparameterNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeiter_Auswertungsparameter_Insert]
|
|
@iMitarbeiternr int,
|
|
@iAuswertungnr int,
|
|
@sBeschreibung varchar(255),
|
|
@sParameterdaten varchar(1024),
|
|
@sTitelzeile1 varchar(255),
|
|
@sTitelzeile2 varchar(255),
|
|
@bParamPrint bit,
|
|
@sSQLWhere varchar(1024),
|
|
@iMitarbeiter_AuswertungsparameterNr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Mitarbeiter_Auswertungsparameter]
|
|
(
|
|
[Mitarbeiternr],
|
|
[Auswertungnr],
|
|
[Beschreibung],
|
|
[Parameterdaten],
|
|
[Titelzeile1],
|
|
[Titelzeile2],
|
|
[ParamPrint],
|
|
[SQLWhere]
|
|
)
|
|
VALUES
|
|
(
|
|
@iMitarbeiternr,
|
|
@iAuswertungnr,
|
|
@sBeschreibung,
|
|
@sParameterdaten,
|
|
@sTitelzeile1,
|
|
@sTitelzeile2,
|
|
@bParamPrint,
|
|
@sSQLWhere
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iMitarbeiter_AuswertungsparameterNr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeiter_Auswertungsparameter_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Mitarbeiter_Auswertungsparameter'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeiter_Auswertungsparameter_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Mitarbeiter_AuswertungsparameterNr],
|
|
[Mitarbeiternr],
|
|
[Auswertungnr],
|
|
[Beschreibung],
|
|
[Parameterdaten],
|
|
[Titelzeile1],
|
|
[Titelzeile2],
|
|
[ParamPrint],
|
|
[SQLWhere]
|
|
FROM [dbo].[Mitarbeiter_Auswertungsparameter]
|
|
ORDER BY
|
|
[Mitarbeiter_AuswertungsparameterNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeiter_Auswertungsparameter_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Mitarbeiter_Auswertungsparameter'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iMitarbeiter_AuswertungsparameterNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeiter_Auswertungsparameter_SelectOne]
|
|
@iMitarbeiter_AuswertungsparameterNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Mitarbeiter_AuswertungsparameterNr],
|
|
[Mitarbeiternr],
|
|
[Auswertungnr],
|
|
[Beschreibung],
|
|
[Parameterdaten],
|
|
[Titelzeile1],
|
|
[Titelzeile2],
|
|
[ParamPrint],
|
|
[SQLWhere]
|
|
FROM [dbo].[Mitarbeiter_Auswertungsparameter]
|
|
WHERE
|
|
[Mitarbeiter_AuswertungsparameterNr] = @iMitarbeiter_AuswertungsparameterNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeiter_Auswertungsparameter_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Mitarbeiter_Auswertungsparameter'
|
|
-- Gets: @iMitarbeiter_AuswertungsparameterNr int
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Gets: @iAuswertungnr int
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @sParameterdaten varchar(1024)
|
|
-- Gets: @sTitelzeile1 varchar(255)
|
|
-- Gets: @sTitelzeile2 varchar(255)
|
|
-- Gets: @bParamPrint bit
|
|
-- Gets: @sSQLWhere varchar(1024)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeiter_Auswertungsparameter_Update]
|
|
@iMitarbeiter_AuswertungsparameterNr int,
|
|
@iMitarbeiternr int,
|
|
@iAuswertungnr int,
|
|
@sBeschreibung varchar(255),
|
|
@sParameterdaten varchar(1024),
|
|
@sTitelzeile1 varchar(255),
|
|
@sTitelzeile2 varchar(255),
|
|
@bParamPrint bit,
|
|
@sSQLWhere varchar(1024),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Mitarbeiter_Auswertungsparameter]
|
|
SET
|
|
[Mitarbeiternr] = @iMitarbeiternr,
|
|
[Auswertungnr] = @iAuswertungnr,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Parameterdaten] = @sParameterdaten,
|
|
[Titelzeile1] = @sTitelzeile1,
|
|
[Titelzeile2] = @sTitelzeile2,
|
|
[ParamPrint] = @bParamPrint,
|
|
[SQLWhere] = @sSQLWhere
|
|
WHERE
|
|
[Mitarbeiter_AuswertungsparameterNr] = @iMitarbeiter_AuswertungsparameterNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'mitarbeiter'
|
|
-- using the Primary Key.
|
|
-- Gets: @imitarbeiternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_Delete]
|
|
@imitarbeiternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[mitarbeiter]
|
|
WHERE
|
|
[mitarbeiternr] = @imitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_funktionsgruppe_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'mitarbeiter_funktionsgruppe'
|
|
-- using the Primary Key.
|
|
-- Gets: @imitarbeiter_funktionsgruppenr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_funktionsgruppe_Delete]
|
|
@imitarbeiter_funktionsgruppenr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[mitarbeiter_funktionsgruppe]
|
|
WHERE
|
|
[mitarbeiter_funktionsgruppenr] = @imitarbeiter_funktionsgruppenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_funktionsgruppe_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'mitarbeiter_funktionsgruppe'
|
|
-- Gets: @imitarbeiter_funktionsgruppenr int
|
|
-- Gets: @imitarbeiternr int
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_funktionsgruppe_Insert]
|
|
@imitarbeiter_funktionsgruppenr int,
|
|
@imitarbeiternr int,
|
|
@ifunktionsgruppenr int,
|
|
@baktiv bit,
|
|
@imandantnr int,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[mitarbeiter_funktionsgruppe]
|
|
(
|
|
[mitarbeiter_funktionsgruppenr],
|
|
[mitarbeiternr],
|
|
[funktionsgruppenr],
|
|
[aktiv],
|
|
[mandantnr],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@imitarbeiter_funktionsgruppenr,
|
|
@imitarbeiternr,
|
|
@ifunktionsgruppenr,
|
|
@baktiv,
|
|
@imandantnr,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_funktionsgruppe_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'mitarbeiter_funktionsgruppe'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_funktionsgruppe_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[mitarbeiter_funktionsgruppenr],
|
|
[mitarbeiternr],
|
|
[funktionsgruppenr],
|
|
[aktiv],
|
|
[mandantnr],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[mitarbeiter_funktionsgruppe]
|
|
ORDER BY
|
|
[mitarbeiter_funktionsgruppenr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_funktionsgruppe_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'mitarbeiter_funktionsgruppe'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_funktionsgruppe_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT TOP 100 PERCENT dbo.mitarbeiter_funktionsgruppe.mitarbeiter_funktionsgruppenr, dbo.mitarbeiter_funktionsgruppe.mitarbeiternr,
|
|
dbo.mitarbeiter.name + ' ' + dbo.mitarbeiter.vorname AS Mitarbeiter, dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr,
|
|
dbo.funktionsgruppe.bezeichnung, dbo.mitarbeiter_funktionsgruppe.aktiv, dbo.mitarbeiter_funktionsgruppe.mandantnr,
|
|
dbo.mitarbeiter_funktionsgruppe.erstellt_am, dbo.mitarbeiter_funktionsgruppe.mutiert_am, dbo.mitarbeiter_funktionsgruppe.mutierer
|
|
FROM dbo.mitarbeiter_funktionsgruppe INNER JOIN
|
|
dbo.mitarbeiter ON dbo.mitarbeiter_funktionsgruppe.mitarbeiternr = dbo.mitarbeiter.mitarbeiternr INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr
|
|
where dbo.mitarbeiter_funktionsgruppe.mitarbeiternr = @keyvalue
|
|
ORDER BY dbo.mitarbeiter_funktionsgruppe.mitarbeiter_funktionsgruppenr
|
|
end else begin
|
|
SELECT TOP 100 PERCENT dbo.mitarbeiter_funktionsgruppe.mitarbeiter_funktionsgruppenr, dbo.mitarbeiter_funktionsgruppe.mitarbeiternr,
|
|
dbo.mitarbeiter.name + ' ' + dbo.mitarbeiter.vorname AS Mitarbeiter, dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr,
|
|
dbo.funktionsgruppe.bezeichnung, dbo.mitarbeiter_funktionsgruppe.aktiv, dbo.mitarbeiter_funktionsgruppe.mandantnr,
|
|
dbo.mitarbeiter_funktionsgruppe.erstellt_am, dbo.mitarbeiter_funktionsgruppe.mutiert_am, dbo.mitarbeiter_funktionsgruppe.mutierer
|
|
FROM dbo.mitarbeiter_funktionsgruppe INNER JOIN
|
|
dbo.mitarbeiter ON dbo.mitarbeiter_funktionsgruppe.mitarbeiternr = dbo.mitarbeiter.mitarbeiternr INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr
|
|
where dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr = @keyvalue
|
|
ORDER BY dbo.mitarbeiter_funktionsgruppe.mitarbeiter_funktionsgruppenr
|
|
end
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_funktionsgruppe_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'mitarbeiter_funktionsgruppe'
|
|
-- based on the Primary Key.
|
|
-- Gets: @imitarbeiter_funktionsgruppenr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_funktionsgruppe_SelectOne]
|
|
@imitarbeiter_funktionsgruppenr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[mitarbeiter_funktionsgruppenr],
|
|
[mitarbeiternr],
|
|
[funktionsgruppenr],
|
|
[aktiv],
|
|
[mandantnr],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[mitarbeiter_funktionsgruppe]
|
|
WHERE
|
|
[mitarbeiter_funktionsgruppenr] = @imitarbeiter_funktionsgruppenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_funktionsgruppe_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'mitarbeiter_funktionsgruppe'
|
|
-- Gets: @imitarbeiter_funktionsgruppenr int
|
|
-- Gets: @imitarbeiternr int
|
|
-- Gets: @ifunktionsgruppenr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_funktionsgruppe_Update]
|
|
@imitarbeiter_funktionsgruppenr int,
|
|
@imitarbeiternr int,
|
|
@ifunktionsgruppenr int,
|
|
@baktiv bit,
|
|
@imandantnr int,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[mitarbeiter_funktionsgruppe]
|
|
SET
|
|
[mitarbeiternr] = @imitarbeiternr,
|
|
[funktionsgruppenr] = @ifunktionsgruppenr,
|
|
[aktiv] = @baktiv,
|
|
[mandantnr] = @imandantnr,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer
|
|
WHERE
|
|
[mitarbeiter_funktionsgruppenr] = @imitarbeiter_funktionsgruppenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'mitarbeiter'
|
|
-- Gets: @imitarbeiternr int
|
|
-- Gets: @svorname varchar(50)
|
|
-- Gets: @sname varchar(50)
|
|
-- Gets: @stgnummer varchar(50)
|
|
-- Gets: @semail varchar(50)
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_Insert]
|
|
@imitarbeiternr int,
|
|
@svorname varchar(50),
|
|
@sname varchar(50),
|
|
@stgnummer varchar(50),
|
|
@semail varchar(50),
|
|
@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].[mitarbeiter]
|
|
(
|
|
[mitarbeiternr],
|
|
[vorname],
|
|
[name],
|
|
[tgnummer],
|
|
[email],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@imitarbeiternr,
|
|
@svorname,
|
|
@sname,
|
|
@stgnummer,
|
|
@semail,
|
|
@imandantnr,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'mitarbeiter'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[mitarbeiternr],
|
|
[vorname],
|
|
[name],
|
|
[tgnummer],
|
|
[email],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[mitarbeiter]
|
|
ORDER BY
|
|
[mitarbeiternr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'mitarbeiter'
|
|
-- based on the Primary Key.
|
|
-- Gets: @imitarbeiternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_SelectOne]
|
|
@imitarbeiternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[mitarbeiternr],
|
|
[vorname],
|
|
[name],
|
|
[tgnummer],
|
|
[email],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[mitarbeiter]
|
|
WHERE
|
|
[mitarbeiternr] = @imitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_mitarbeiter_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'mitarbeiter'
|
|
-- Gets: @imitarbeiternr int
|
|
-- Gets: @svorname varchar(50)
|
|
-- Gets: @sname varchar(50)
|
|
-- Gets: @stgnummer varchar(50)
|
|
-- Gets: @semail varchar(50)
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_mitarbeiter_Update]
|
|
@imitarbeiternr int,
|
|
@svorname varchar(50),
|
|
@sname varchar(50),
|
|
@stgnummer varchar(50),
|
|
@semail varchar(50),
|
|
@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].[mitarbeiter]
|
|
SET
|
|
[vorname] = @svorname,
|
|
[name] = @sname,
|
|
[tgnummer] = @stgnummer,
|
|
[email] = @semail,
|
|
[mandantnr] = @imandantnr,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer
|
|
WHERE
|
|
[mitarbeiternr] = @imitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Mitarbeitereinstellung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iMitarbeitereinstellungnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_Delete]
|
|
@iMitarbeitereinstellungnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Mitarbeitereinstellung]
|
|
WHERE
|
|
[Mitarbeitereinstellungnr] = @iMitarbeitereinstellungnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_DeleteAllWMitarbeiternrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Mitarbeitereinstellung'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_DeleteAllWMitarbeiternrLogic]
|
|
@iMitarbeiternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Mitarbeitereinstellung]
|
|
WHERE
|
|
[Mitarbeiternr] = @iMitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Mitarbeitereinstellung'
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Gets: @bVertragsuebersicht bit
|
|
-- Gets: @bPendenzen bit
|
|
-- Gets: @bAktivitaeten bit
|
|
-- Gets: @bApplikationsuebersicht bit
|
|
-- Gets: @bReporting bit
|
|
-- Gets: @bLizenzmanagement bit
|
|
-- Gets: @iWPos1 int
|
|
-- Gets: @iWPos2 int
|
|
-- Gets: @iWPos3 int
|
|
-- Gets: @iWPos4 int
|
|
-- Gets: @iWPos5 int
|
|
-- Gets: @iWPos6 int
|
|
-- Gets: @sWParam1 varchar(255)
|
|
-- Gets: @sWParam2 varchar(255)
|
|
-- Gets: @sWParam3 varchar(255)
|
|
-- Gets: @sWParam4 varchar(255)
|
|
-- Gets: @sWParam5 varchar(255)
|
|
-- Gets: @sWParam6 varchar(255)
|
|
-- Returns: @iMitarbeitereinstellungnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_Insert]
|
|
@iMitarbeiternr int,
|
|
@bVertragsuebersicht bit,
|
|
@bPendenzen bit,
|
|
@bAktivitaeten bit,
|
|
@bApplikationsuebersicht bit,
|
|
@bReporting bit,
|
|
@bLizenzmanagement bit,
|
|
@iWPos1 int,
|
|
@iWPos2 int,
|
|
@iWPos3 int,
|
|
@iWPos4 int,
|
|
@iWPos5 int,
|
|
@iWPos6 int,
|
|
@sWParam1 varchar(255),
|
|
@sWParam2 varchar(255),
|
|
@sWParam3 varchar(255),
|
|
@sWParam4 varchar(255),
|
|
@sWParam5 varchar(255),
|
|
@sWParam6 varchar(255),
|
|
@iMitarbeitereinstellungnr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Mitarbeitereinstellung]
|
|
(
|
|
[Mitarbeiternr],
|
|
[Vertragsuebersicht],
|
|
[Pendenzen],
|
|
[Aktivitaeten],
|
|
[Applikationsuebersicht],
|
|
[Reporting],
|
|
[Lizenzmanagement],
|
|
[WPos1],
|
|
[WPos2],
|
|
[WPos3],
|
|
[WPos4],
|
|
[WPos5],
|
|
[WPos6],
|
|
[WParam1],
|
|
[WParam2],
|
|
[WParam3],
|
|
[WParam4],
|
|
[WParam5],
|
|
[WParam6]
|
|
)
|
|
VALUES
|
|
(
|
|
@iMitarbeiternr,
|
|
@bVertragsuebersicht,
|
|
@bPendenzen,
|
|
@bAktivitaeten,
|
|
@bApplikationsuebersicht,
|
|
@bReporting,
|
|
@bLizenzmanagement,
|
|
@iWPos1,
|
|
@iWPos2,
|
|
@iWPos3,
|
|
@iWPos4,
|
|
@iWPos5,
|
|
@iWPos6,
|
|
@sWParam1,
|
|
@sWParam2,
|
|
@sWParam3,
|
|
@sWParam4,
|
|
@sWParam5,
|
|
@sWParam6
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iMitarbeitereinstellungnr=SCOPE_IDENTITY()
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Mitarbeitereinstellung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Mitarbeitereinstellungnr],
|
|
[Mitarbeiternr],
|
|
[Vertragsuebersicht],
|
|
[Pendenzen],
|
|
[Aktivitaeten],
|
|
[Applikationsuebersicht],
|
|
[Reporting],
|
|
[Lizenzmanagement],
|
|
[WPos1],
|
|
[WPos2],
|
|
[WPos3],
|
|
[WPos4],
|
|
[WPos5],
|
|
[WPos6],
|
|
[WParam1],
|
|
[WParam2],
|
|
[WParam3],
|
|
[WParam4],
|
|
[WParam5],
|
|
[WParam6]
|
|
FROM [dbo].[Mitarbeitereinstellung]
|
|
ORDER BY
|
|
[Mitarbeitereinstellungnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_SelectAllWMitarbeiternrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Mitarbeitereinstellung'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_SelectAllWMitarbeiternrLogic]
|
|
@iMitarbeiternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[Mitarbeitereinstellungnr],
|
|
[Mitarbeiternr],
|
|
[Vertragsuebersicht],
|
|
[Pendenzen],
|
|
[Aktivitaeten],
|
|
[Applikationsuebersicht],
|
|
[Reporting],
|
|
[Lizenzmanagement],
|
|
[WPos1],
|
|
[WPos2],
|
|
[WPos3],
|
|
[WPos4],
|
|
[WPos5],
|
|
[WPos6],
|
|
[WParam1],
|
|
[WParam2],
|
|
[WParam3],
|
|
[WParam4],
|
|
[WParam5],
|
|
[WParam6]
|
|
FROM [dbo].[Mitarbeitereinstellung]
|
|
WHERE
|
|
[Mitarbeiternr] = @iMitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Mitarbeitereinstellung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iMitarbeitereinstellungnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_SelectOne]
|
|
@iMitarbeitereinstellungnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Mitarbeitereinstellungnr],
|
|
[Mitarbeiternr],
|
|
[Vertragsuebersicht],
|
|
[Pendenzen],
|
|
[Aktivitaeten],
|
|
[Applikationsuebersicht],
|
|
[Reporting],
|
|
[Lizenzmanagement],
|
|
[WPos1],
|
|
[WPos2],
|
|
[WPos3],
|
|
[WPos4],
|
|
[WPos5],
|
|
[WPos6],
|
|
[WParam1],
|
|
[WParam2],
|
|
[WParam3],
|
|
[WParam4],
|
|
[WParam5],
|
|
[WParam6]
|
|
FROM [dbo].[Mitarbeitereinstellung]
|
|
WHERE
|
|
[Mitarbeitereinstellungnr] = @iMitarbeitereinstellungnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Mitarbeitereinstellung'
|
|
-- Gets: @iMitarbeitereinstellungnr int
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Gets: @bVertragsuebersicht bit
|
|
-- Gets: @bPendenzen bit
|
|
-- Gets: @bAktivitaeten bit
|
|
-- Gets: @bApplikationsuebersicht bit
|
|
-- Gets: @bReporting bit
|
|
-- Gets: @bLizenzmanagement bit
|
|
-- Gets: @iWPos1 int
|
|
-- Gets: @iWPos2 int
|
|
-- Gets: @iWPos3 int
|
|
-- Gets: @iWPos4 int
|
|
-- Gets: @iWPos5 int
|
|
-- Gets: @iWPos6 int
|
|
-- Gets: @sWParam1 varchar(255)
|
|
-- Gets: @sWParam2 varchar(255)
|
|
-- Gets: @sWParam3 varchar(255)
|
|
-- Gets: @sWParam4 varchar(255)
|
|
-- Gets: @sWParam5 varchar(255)
|
|
-- Gets: @sWParam6 varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_Update]
|
|
@iMitarbeitereinstellungnr int,
|
|
@iMitarbeiternr int,
|
|
@bVertragsuebersicht bit,
|
|
@bPendenzen bit,
|
|
@bAktivitaeten bit,
|
|
@bApplikationsuebersicht bit,
|
|
@bReporting bit,
|
|
@bLizenzmanagement bit,
|
|
@iWPos1 int,
|
|
@iWPos2 int,
|
|
@iWPos3 int,
|
|
@iWPos4 int,
|
|
@iWPos5 int,
|
|
@iWPos6 int,
|
|
@sWParam1 varchar(255),
|
|
@sWParam2 varchar(255),
|
|
@sWParam3 varchar(255),
|
|
@sWParam4 varchar(255),
|
|
@sWParam5 varchar(255),
|
|
@sWParam6 varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Mitarbeitereinstellung]
|
|
SET
|
|
[Mitarbeiternr] = @iMitarbeiternr,
|
|
[Vertragsuebersicht] = @bVertragsuebersicht,
|
|
[Pendenzen] = @bPendenzen,
|
|
[Aktivitaeten] = @bAktivitaeten,
|
|
[Applikationsuebersicht] = @bApplikationsuebersicht,
|
|
[Reporting] = @bReporting,
|
|
[Lizenzmanagement] = @bLizenzmanagement,
|
|
[WPos1] = @iWPos1,
|
|
[WPos2] = @iWPos2,
|
|
[WPos3] = @iWPos3,
|
|
[WPos4] = @iWPos4,
|
|
[WPos5] = @iWPos5,
|
|
[WPos6] = @iWPos6,
|
|
[WParam1] = @sWParam1,
|
|
[WParam2] = @sWParam2,
|
|
[WParam3] = @sWParam3,
|
|
[WParam4] = @sWParam4,
|
|
[WParam5] = @sWParam5,
|
|
[WParam6] = @sWParam6
|
|
WHERE
|
|
[Mitarbeitereinstellungnr] = @iMitarbeitereinstellungnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Mitarbeitereinstellung_UpdateAllWMitarbeiternrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Mitarbeitereinstellung'.
|
|
-- Will reset field [Mitarbeiternr] with value @iMitarbeiternrOld to value @iMitarbeiternr
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Gets: @iMitarbeiternrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Mitarbeitereinstellung_UpdateAllWMitarbeiternrLogic]
|
|
@iMitarbeiternr int,
|
|
@iMitarbeiternrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Mitarbeitereinstellung]
|
|
SET
|
|
[Mitarbeiternr] = @iMitarbeiternr
|
|
WHERE
|
|
[Mitarbeiternr] = @iMitarbeiternrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MitarbeiterTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'MitarbeiterTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iMitarbeiterTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MitarbeiterTyp_Delete]
|
|
@iMitarbeiterTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[MitarbeiterTyp]
|
|
WHERE
|
|
[MitarbeiterTypNr] = @iMitarbeiterTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MitarbeiterTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'MitarbeiterTyp'
|
|
-- Gets: @iMitarbeiterTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @iFuehrungsanteil int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MitarbeiterTyp_Insert]
|
|
@iMitarbeiterTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@iFuehrungsanteil 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].[MitarbeiterTyp]
|
|
(
|
|
[MitarbeiterTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Fuehrungsanteil],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iMitarbeiterTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@iFuehrungsanteil,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MitarbeiterTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'MitarbeiterTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MitarbeiterTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[MitarbeiterTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Fuehrungsanteil],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[MitarbeiterTyp]
|
|
ORDER BY
|
|
[MitarbeiterTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MitarbeiterTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'MitarbeiterTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iMitarbeiterTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MitarbeiterTyp_SelectOne]
|
|
@iMitarbeiterTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[MitarbeiterTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Fuehrungsanteil],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[MitarbeiterTyp]
|
|
WHERE
|
|
[MitarbeiterTypNr] = @iMitarbeiterTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_MitarbeiterTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'MitarbeiterTyp'
|
|
-- Gets: @iMitarbeiterTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @iFuehrungsanteil int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_MitarbeiterTyp_Update]
|
|
@iMitarbeiterTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@iFuehrungsanteil 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].[MitarbeiterTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Fuehrungsanteil] = @iFuehrungsanteil,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[MitarbeiterTypNr] = @iMitarbeiterTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_OE_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'OE'
|
|
-- using the Primary Key.
|
|
-- Gets: @iOeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_OE_Delete]
|
|
@iOeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[OE]
|
|
WHERE
|
|
[OeNr] = @iOeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_OE_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'OE'
|
|
-- Gets: @iOeNr int
|
|
-- Gets: @iParentId int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sKuerzel varchar(50)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSortierung int
|
|
-- Gets: @iPlanwert_RTB_Team int
|
|
-- Gets: @iReduktion_Nicht_Verrechenbar int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_OE_Insert]
|
|
@iOeNr int,
|
|
@iParentId int,
|
|
@sBezeichnung varchar(50),
|
|
@sKuerzel varchar(50),
|
|
@sBeschreibung varchar(1024),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSortierung int,
|
|
@iPlanwert_RTB_Team int,
|
|
@iReduktion_Nicht_Verrechenbar int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[OE]
|
|
(
|
|
[OeNr],
|
|
[ParentId],
|
|
[Bezeichnung],
|
|
[Kuerzel],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Sortierung],
|
|
[Planwert_RTB_Team],
|
|
[Reduktion_Nicht_Verrechenbar]
|
|
)
|
|
VALUES
|
|
(
|
|
@iOeNr,
|
|
@iParentId,
|
|
@sBezeichnung,
|
|
@sKuerzel,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iSortierung,
|
|
@iPlanwert_RTB_Team,
|
|
@iReduktion_Nicht_Verrechenbar
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_OE_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'OE'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_OE_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[OeNr],
|
|
[ParentId],
|
|
[Bezeichnung],
|
|
[Kuerzel],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Sortierung],
|
|
[Planwert_RTB_Team],
|
|
[Reduktion_Nicht_Verrechenbar]
|
|
FROM [dbo].[OE]
|
|
ORDER BY
|
|
[OeNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_OE_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'OE'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iOeNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_OE_SelectOne]
|
|
@iOeNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[OeNr],
|
|
[ParentId],
|
|
[Bezeichnung],
|
|
[Kuerzel],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Sortierung],
|
|
[Planwert_RTB_Team],
|
|
[Reduktion_Nicht_Verrechenbar]
|
|
FROM [dbo].[OE]
|
|
WHERE
|
|
[OeNr] = @iOeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_OE_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'OE'
|
|
-- Gets: @iOeNr int
|
|
-- Gets: @iParentId int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sKuerzel varchar(50)
|
|
-- Gets: @sBeschreibung varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iSortierung int
|
|
-- Gets: @iPlanwert_RTB_Team int
|
|
-- Gets: @iReduktion_Nicht_Verrechenbar int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_OE_Update]
|
|
@iOeNr int,
|
|
@iParentId int,
|
|
@sBezeichnung varchar(50),
|
|
@sKuerzel varchar(50),
|
|
@sBeschreibung varchar(1024),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iSortierung int,
|
|
@iPlanwert_RTB_Team int,
|
|
@iReduktion_Nicht_Verrechenbar int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[OE]
|
|
SET
|
|
[ParentId] = @iParentId,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Kuerzel] = @sKuerzel,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Sortierung] = @iSortierung,
|
|
[Planwert_RTB_Team] = @iPlanwert_RTB_Team,
|
|
[Reduktion_Nicht_Verrechenbar] = @iReduktion_Nicht_Verrechenbar
|
|
WHERE
|
|
[OeNr] = @iOeNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenz_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Pendenz'
|
|
-- using the Primary Key.
|
|
-- Gets: @iPendenzNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenz_Delete]
|
|
@iPendenzNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Pendenz]
|
|
WHERE
|
|
[PendenzNr] = @iPendenzNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenz_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Pendenz'
|
|
-- Gets: @iPendenzNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @sVerantwortlich varchar(50)
|
|
-- Gets: @iPendenzStatusNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @daTermin datetime
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenz_Insert]
|
|
@iPendenzNr int,
|
|
@iVertragselementNr int,
|
|
@sVerantwortlich varchar(50),
|
|
@iPendenzStatusNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@daTermin datetime,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Pendenz]
|
|
(
|
|
[PendenzNr],
|
|
[VertragselementNr],
|
|
[Verantwortlich],
|
|
[PendenzStatusNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Termin],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iPendenzNr,
|
|
@iVertragselementNr,
|
|
@sVerantwortlich,
|
|
@iPendenzStatusNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@daTermin,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr,
|
|
@iSecurityLevelNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenz_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Pendenz'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenz_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[PendenzNr],
|
|
[VertragselementNr],
|
|
[Verantwortlich],
|
|
[PendenzStatusNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Termin],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Pendenz]
|
|
ORDER BY
|
|
[PendenzNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_pendenz_selectall_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[pr_pendenz_selectall_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT dbo.Pendenz.PendenzNr, dbo.Pendenz.VertragselementNr, dbo.Pendenz.PendenzStatusNr, dbo.Pendenzstatus.Bezeichnung AS Pendenz_Status,
|
|
dbo.Pendenz.Bezeichnung AS Pendenz_Bezeichnung, dbo.Pendenz.Beschreibung, dbo.Pendenz.Termin, dbo.pendenz.Verantwortlich, dbo.Pendenz.Aktiv, dbo.Pendenz.Erstellt_am,
|
|
dbo.Pendenz.Mutiert_am, dbo.Pendenz.Mutierer, dbo.Pendenz.SecurityLevelNr
|
|
FROM dbo.Pendenz INNER JOIN
|
|
dbo.Pendenzstatus ON dbo.Pendenz.PendenzStatusNr = dbo.Pendenzstatus.PendenzStatusNr
|
|
where dbo.Pendenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and vertragselementnr = @keyvalue
|
|
ORDER BY
|
|
[Pendenznr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenz_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Pendenz'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iPendenzNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenz_SelectOne]
|
|
@iPendenzNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[PendenzNr],
|
|
[VertragselementNr],
|
|
[Verantwortlich],
|
|
[PendenzStatusNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Termin],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Pendenz]
|
|
WHERE
|
|
[PendenzNr] = @iPendenzNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenz_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Pendenz'
|
|
-- Gets: @iPendenzNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @sVerantwortlich varchar(50)
|
|
-- Gets: @iPendenzStatusNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @daTermin datetime
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenz_Update]
|
|
@iPendenzNr int,
|
|
@iVertragselementNr int,
|
|
@sVerantwortlich varchar(50),
|
|
@iPendenzStatusNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@daTermin datetime,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Pendenz]
|
|
SET
|
|
[VertragselementNr] = @iVertragselementNr,
|
|
[Verantwortlich] = @sVerantwortlich,
|
|
[PendenzStatusNr] = @iPendenzStatusNr,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Termin] = @daTermin,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
WHERE
|
|
[PendenzNr] = @iPendenzNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenzstatus_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Pendenzstatus'
|
|
-- using the Primary Key.
|
|
-- Gets: @iPendenzStatusNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenzstatus_Delete]
|
|
@iPendenzStatusNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Pendenzstatus]
|
|
WHERE
|
|
[PendenzStatusNr] = @iPendenzStatusNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenzstatus_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Pendenzstatus'
|
|
-- Gets: @iPendenzStatusNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @bPendenz_Aktivieren bit
|
|
-- Gets: @bPendenz_Inaktivieren bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenzstatus_Insert]
|
|
@iPendenzStatusNr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@bPendenz_Aktivieren bit,
|
|
@bPendenz_Inaktivieren bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Pendenzstatus]
|
|
(
|
|
[PendenzStatusNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Pendenz_Aktivieren],
|
|
[Pendenz_Inaktivieren]
|
|
)
|
|
VALUES
|
|
(
|
|
@iPendenzStatusNr,
|
|
@sBezeichnung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@bPendenz_Aktivieren,
|
|
@bPendenz_Inaktivieren
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenzstatus_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Pendenzstatus'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenzstatus_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[PendenzStatusNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Pendenz_Aktivieren],
|
|
[Pendenz_Inaktivieren]
|
|
FROM [dbo].[Pendenzstatus]
|
|
ORDER BY
|
|
[PendenzStatusNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenzstatus_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Pendenzstatus'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iPendenzStatusNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenzstatus_SelectOne]
|
|
@iPendenzStatusNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[PendenzStatusNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Pendenz_Aktivieren],
|
|
[Pendenz_Inaktivieren]
|
|
FROM [dbo].[Pendenzstatus]
|
|
WHERE
|
|
[PendenzStatusNr] = @iPendenzStatusNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Pendenzstatus_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Pendenzstatus'
|
|
-- Gets: @iPendenzStatusNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @bPendenz_Aktivieren bit
|
|
-- Gets: @bPendenz_Inaktivieren bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Pendenzstatus_Update]
|
|
@iPendenzStatusNr int,
|
|
@sBezeichnung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@bPendenz_Aktivieren bit,
|
|
@bPendenz_Inaktivieren bit,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Pendenzstatus]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[Pendenz_Aktivieren] = @bPendenz_Aktivieren,
|
|
[Pendenz_Inaktivieren] = @bPendenz_Inaktivieren
|
|
WHERE
|
|
[PendenzStatusNr] = @iPendenzStatusNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Periodizitaet_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Periodizitaet'
|
|
-- using the Primary Key.
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Periodizitaet_Delete]
|
|
@iPeriodizitaetNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Periodizitaet]
|
|
WHERE
|
|
[PeriodizitaetNr] = @iPeriodizitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Periodizitaet_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Periodizitaet'
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @fZeit float(53)
|
|
-- Gets: @sZeiteinheit varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Periodizitaet_Insert]
|
|
@iPeriodizitaetNr int,
|
|
@sBezeichnung varchar(50),
|
|
@fZeit float(53),
|
|
@sZeiteinheit varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Periodizitaet]
|
|
(
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Zeit],
|
|
[Zeiteinheit],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[Sort]
|
|
)
|
|
VALUES
|
|
(
|
|
@iPeriodizitaetNr,
|
|
@sBezeichnung,
|
|
@fZeit,
|
|
@sZeiteinheit,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr,
|
|
@iSort
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Periodizitaet_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Periodizitaet'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Periodizitaet_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Zeit],
|
|
[Zeiteinheit],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[Sort]
|
|
FROM [dbo].[Periodizitaet]
|
|
ORDER BY
|
|
[PeriodizitaetNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Periodizitaet_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Periodizitaet'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Periodizitaet_SelectOne]
|
|
@iPeriodizitaetNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Zeit],
|
|
[Zeiteinheit],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[Sort]
|
|
FROM [dbo].[Periodizitaet]
|
|
WHERE
|
|
[PeriodizitaetNr] = @iPeriodizitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Periodizitaet_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Periodizitaet'
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @fZeit float(53)
|
|
-- Gets: @sZeiteinheit varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSort int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Periodizitaet_Update]
|
|
@iPeriodizitaetNr int,
|
|
@sBezeichnung varchar(50),
|
|
@fZeit float(53),
|
|
@sZeiteinheit varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSort int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Periodizitaet]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Zeit] = @fZeit,
|
|
[Zeiteinheit] = @sZeiteinheit,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr,
|
|
[Sort] = @iSort
|
|
WHERE
|
|
[PeriodizitaetNr] = @iPeriodizitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Person'
|
|
-- using the Primary Key.
|
|
-- Gets: @iPersonNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_Delete]
|
|
@iPersonNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Person]
|
|
WHERE
|
|
[PersonNr] = @iPersonNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_DeleteAllWVertragspartnernrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Person'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragspartnernr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_DeleteAllWVertragspartnernrLogic]
|
|
@iVertragspartnernr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Person]
|
|
WHERE
|
|
[Vertragspartnernr] = @iVertragspartnernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Person'
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @iVertragspartnernr int
|
|
-- Gets: @sName varchar(50)
|
|
-- Gets: @sVorname varchar(50)
|
|
-- Gets: @sStrasse varchar(50)
|
|
-- Gets: @sPostfach varchar(50)
|
|
-- Gets: @sPlz varchar(50)
|
|
-- Gets: @sOrt varchar(50)
|
|
-- Gets: @sTelefon varchar(50)
|
|
-- Gets: @sTelefax varchar(50)
|
|
-- Gets: @sEMail varchar(50)
|
|
-- Gets: @sInternet varchar(50)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iPersonFunktionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_Insert]
|
|
@iPersonNr int,
|
|
@iVertragspartnernr int,
|
|
@sName varchar(50),
|
|
@sVorname varchar(50),
|
|
@sStrasse varchar(50),
|
|
@sPostfach varchar(50),
|
|
@sPlz varchar(50),
|
|
@sOrt varchar(50),
|
|
@sTelefon varchar(50),
|
|
@sTelefax varchar(50),
|
|
@sEMail varchar(50),
|
|
@sInternet varchar(50),
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSecurityLevelNr int,
|
|
@iPersonFunktionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Person]
|
|
(
|
|
[PersonNr],
|
|
[Vertragspartnernr],
|
|
[Name],
|
|
[Vorname],
|
|
[Strasse],
|
|
[Postfach],
|
|
[Plz],
|
|
[Ort],
|
|
[Telefon],
|
|
[Telefax],
|
|
[EMail],
|
|
[Internet],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[PersonFunktionNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iPersonNr,
|
|
@iVertragspartnernr,
|
|
@sName,
|
|
@sVorname,
|
|
@sStrasse,
|
|
@sPostfach,
|
|
@sPlz,
|
|
@sOrt,
|
|
@sTelefon,
|
|
@sTelefax,
|
|
@sEMail,
|
|
@sInternet,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr,
|
|
@iSecurityLevelNr,
|
|
@iPersonFunktionNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Person'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[PersonNr],
|
|
[Vertragspartnernr],
|
|
[Name],
|
|
[Vorname],
|
|
[Strasse],
|
|
[Postfach],
|
|
[Plz],
|
|
[Ort],
|
|
[Telefon],
|
|
[Telefax],
|
|
[EMail],
|
|
[Internet],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[PersonFunktionNr]
|
|
FROM [dbo].[Person]
|
|
ORDER BY
|
|
[PersonNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Person'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_Person_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT dbo.Person.PersonNr, dbo.Person.Vertragspartnernr, dbo.Person.Name, dbo.Person.Vorname, dbo.Person.Strasse, dbo.Person.Postfach, dbo.Person.Plz,
|
|
dbo.Person.Ort, dbo.Person.Telefon, dbo.Person.Telefax, dbo.Person.EMail, dbo.Person.Internet, dbo.Person.Bemerkung, dbo.Person.Aktiv, dbo.Person.Erstellt_am,
|
|
dbo.Person.Mutiert_am, dbo.Person.Mutierer, dbo.Person.MandantNr, dbo.Person.SecurityLevelNr, ISNULL(dbo.PersonFunktion.Bezeichnung, '') AS Funktion
|
|
FROM dbo.Person LEFT OUTER JOIN
|
|
dbo.PersonFunktion ON dbo.Person.PersonFunktionNr = dbo.PersonFunktion.PersonFunktionNr
|
|
where dbo.Person.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and vertragspartnernr = @keyvalue
|
|
ORDER BY
|
|
Name, vorname ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_SelectAllWVertragspartnernrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Person'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragspartnernr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_SelectAllWVertragspartnernrLogic]
|
|
@iVertragspartnernr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[PersonNr],
|
|
[Vertragspartnernr],
|
|
[Name],
|
|
[Vorname],
|
|
[Strasse],
|
|
[Postfach],
|
|
[Plz],
|
|
[Ort],
|
|
[Telefon],
|
|
[Telefax],
|
|
[EMail],
|
|
[Internet],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[PersonFunktionNr]
|
|
FROM [dbo].[Person]
|
|
WHERE
|
|
[Vertragspartnernr] = @iVertragspartnernr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Person'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iPersonNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_SelectOne]
|
|
@iPersonNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[PersonNr],
|
|
[Vertragspartnernr],
|
|
[Name],
|
|
[Vorname],
|
|
[Strasse],
|
|
[Postfach],
|
|
[Plz],
|
|
[Ort],
|
|
[Telefon],
|
|
[Telefax],
|
|
[EMail],
|
|
[Internet],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[PersonFunktionNr]
|
|
FROM [dbo].[Person]
|
|
WHERE
|
|
[PersonNr] = @iPersonNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Person'
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @iVertragspartnernr int
|
|
-- Gets: @sName varchar(50)
|
|
-- Gets: @sVorname varchar(50)
|
|
-- Gets: @sStrasse varchar(50)
|
|
-- Gets: @sPostfach varchar(50)
|
|
-- Gets: @sPlz varchar(50)
|
|
-- Gets: @sOrt varchar(50)
|
|
-- Gets: @sTelefon varchar(50)
|
|
-- Gets: @sTelefax varchar(50)
|
|
-- Gets: @sEMail varchar(50)
|
|
-- Gets: @sInternet varchar(50)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iPersonFunktionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_Update]
|
|
@iPersonNr int,
|
|
@iVertragspartnernr int,
|
|
@sName varchar(50),
|
|
@sVorname varchar(50),
|
|
@sStrasse varchar(50),
|
|
@sPostfach varchar(50),
|
|
@sPlz varchar(50),
|
|
@sOrt varchar(50),
|
|
@sTelefon varchar(50),
|
|
@sTelefax varchar(50),
|
|
@sEMail varchar(50),
|
|
@sInternet varchar(50),
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSecurityLevelNr int,
|
|
@iPersonFunktionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Person]
|
|
SET
|
|
[Vertragspartnernr] = @iVertragspartnernr,
|
|
[Name] = @sName,
|
|
[Vorname] = @sVorname,
|
|
[Strasse] = @sStrasse,
|
|
[Postfach] = @sPostfach,
|
|
[Plz] = @sPlz,
|
|
[Ort] = @sOrt,
|
|
[Telefon] = @sTelefon,
|
|
[Telefax] = @sTelefax,
|
|
[EMail] = @sEMail,
|
|
[Internet] = @sInternet,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[PersonFunktionNr] = @iPersonFunktionNr
|
|
WHERE
|
|
[PersonNr] = @iPersonNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Person_UpdateAllWVertragspartnernrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Person'.
|
|
-- Will reset field [Vertragspartnernr] with value @iVertragspartnernrOld to value @iVertragspartnernr
|
|
-- Gets: @iVertragspartnernr int
|
|
-- Gets: @iVertragspartnernrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Person_UpdateAllWVertragspartnernrLogic]
|
|
@iVertragspartnernr int,
|
|
@iVertragspartnernrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Person]
|
|
SET
|
|
[Vertragspartnernr] = @iVertragspartnernr
|
|
WHERE
|
|
[Vertragspartnernr] = @iVertragspartnernrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_PersonFunktion_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'PersonFunktion'
|
|
-- using the Primary Key.
|
|
-- Gets: @iPersonFunktionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_PersonFunktion_Delete]
|
|
@iPersonFunktionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[PersonFunktion]
|
|
WHERE
|
|
[PersonFunktionNr] = @iPersonFunktionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_PersonFunktion_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'PersonFunktion'
|
|
-- Gets: @iPersonFunktionNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_PersonFunktion_Insert]
|
|
@iPersonFunktionNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[PersonFunktion]
|
|
(
|
|
[PersonFunktionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iPersonFunktionNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_PersonFunktion_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'PersonFunktion'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_PersonFunktion_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[PersonFunktionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[PersonFunktion]
|
|
ORDER BY
|
|
[PersonFunktionNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_PersonFunktion_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'PersonFunktion'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iPersonFunktionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_PersonFunktion_SelectOne]
|
|
@iPersonFunktionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[PersonFunktionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[PersonFunktion]
|
|
WHERE
|
|
[PersonFunktionNr] = @iPersonFunktionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_PersonFunktion_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'PersonFunktion'
|
|
-- Gets: @iPersonFunktionNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_PersonFunktion_Update]
|
|
@iPersonFunktionNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[PersonFunktion]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[PersonFunktionNr] = @iPersonFunktionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Profil_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Profil'
|
|
-- using the Primary Key.
|
|
-- Gets: @iProfilnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Profil_Delete]
|
|
@iProfilnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Profil]
|
|
WHERE
|
|
[Profilnr] = @iProfilnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Profil_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Profil'
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Gets: @sBezeichnung varchar(25)
|
|
-- Gets: @blobV_Uebersicht image
|
|
-- Gets: @sV_Aktiv_Vertragselemente varchar(10)
|
|
-- Gets: @bV_Aktiv_Vertragspartner bit
|
|
-- Gets: @bV_Struktur_Details bit
|
|
-- Gets: @bSelektionsart bit
|
|
-- Gets: @bStandard bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @sV_Sort varchar(1024)
|
|
-- Gets: @sV_Register varchar(1024)
|
|
-- Returns: @iProfilnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Profil_Insert]
|
|
@iMitarbeiternr int,
|
|
@sBezeichnung varchar(25),
|
|
@blobV_Uebersicht image,
|
|
@sV_Aktiv_Vertragselemente varchar(10),
|
|
@bV_Aktiv_Vertragspartner bit,
|
|
@bV_Struktur_Details bit,
|
|
@bSelektionsart bit,
|
|
@bStandard bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@sV_Sort varchar(1024),
|
|
@sV_Register varchar(1024),
|
|
@iProfilnr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Profil]
|
|
(
|
|
[Mitarbeiternr],
|
|
[Bezeichnung],
|
|
[V_Uebersicht],
|
|
[V_Aktiv_Vertragselemente],
|
|
[V_Aktiv_Vertragspartner],
|
|
[V_Struktur_Details],
|
|
[Selektionsart],
|
|
[Standard],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[V_Sort],
|
|
[V_Register]
|
|
)
|
|
VALUES
|
|
(
|
|
@iMitarbeiternr,
|
|
@sBezeichnung,
|
|
@blobV_Uebersicht,
|
|
@sV_Aktiv_Vertragselemente,
|
|
@bV_Aktiv_Vertragspartner,
|
|
@bV_Struktur_Details,
|
|
@bSelektionsart,
|
|
@bStandard,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv,
|
|
@sV_Sort,
|
|
@sV_Register
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iProfilnr=SCOPE_IDENTITY()
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Profil_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Profil'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Profil_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Profilnr],
|
|
[Mitarbeiternr],
|
|
[Bezeichnung],
|
|
[V_Uebersicht],
|
|
[V_Aktiv_Vertragselemente],
|
|
[V_Aktiv_Vertragspartner],
|
|
[V_Struktur_Details],
|
|
[Selektionsart],
|
|
[Standard],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[V_Sort],
|
|
[V_Register]
|
|
FROM [dbo].[Profil]
|
|
ORDER BY
|
|
[Profilnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Profil_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Profil'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iProfilnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Profil_SelectOne]
|
|
@iProfilnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Profilnr],
|
|
[Mitarbeiternr],
|
|
[Bezeichnung],
|
|
[V_Uebersicht],
|
|
[V_Aktiv_Vertragselemente],
|
|
[V_Aktiv_Vertragspartner],
|
|
[V_Struktur_Details],
|
|
[Selektionsart],
|
|
[Standard],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv],
|
|
[V_Sort],
|
|
[V_Register]
|
|
FROM [dbo].[Profil]
|
|
WHERE
|
|
[Profilnr] = @iProfilnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Profil_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Profil'
|
|
-- Gets: @iProfilnr int
|
|
-- Gets: @iMitarbeiternr int
|
|
-- Gets: @sBezeichnung varchar(25)
|
|
-- Gets: @blobV_Uebersicht image
|
|
-- Gets: @sV_Aktiv_Vertragselemente varchar(10)
|
|
-- Gets: @bV_Aktiv_Vertragspartner bit
|
|
-- Gets: @bV_Struktur_Details bit
|
|
-- Gets: @bSelektionsart bit
|
|
-- Gets: @bStandard bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @sV_Sort varchar(1024)
|
|
-- Gets: @sV_Register varchar(1024)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Profil_Update]
|
|
@iProfilnr int,
|
|
@iMitarbeiternr int,
|
|
@sBezeichnung varchar(25),
|
|
@blobV_Uebersicht image,
|
|
@sV_Aktiv_Vertragselemente varchar(10),
|
|
@bV_Aktiv_Vertragspartner bit,
|
|
@bV_Struktur_Details bit,
|
|
@bSelektionsart bit,
|
|
@bStandard bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@sV_Sort varchar(1024),
|
|
@sV_Register varchar(1024),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Profil]
|
|
SET
|
|
[Mitarbeiternr] = @iMitarbeiternr,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[V_Uebersicht] = @blobV_Uebersicht,
|
|
[V_Aktiv_Vertragselemente] = @sV_Aktiv_Vertragselemente,
|
|
[V_Aktiv_Vertragspartner] = @bV_Aktiv_Vertragspartner,
|
|
[V_Struktur_Details] = @bV_Struktur_Details,
|
|
[Selektionsart] = @bSelektionsart,
|
|
[Standard] = @bStandard,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv,
|
|
[V_Sort] = @sV_Sort,
|
|
[V_Register] = @sV_Register
|
|
WHERE
|
|
[Profilnr] = @iProfilnr
|
|
-- Get the Error Code for the statement just executed.
|
|
|
|
if @bStandard=1 begin
|
|
update Profil set Standard=0 where Profilnr<>@iProfilnr and Mitarbeiternr=@iMitarbeiternr
|
|
end
|
|
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Queries_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Queries'
|
|
-- using the Primary Key.
|
|
-- Gets: @iQueryNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Queries_Delete]
|
|
@iQueryNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Queries]
|
|
WHERE
|
|
[QueryNr] = @iQueryNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Queries_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Queries'
|
|
-- Gets: @iQueryNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Queries_Insert]
|
|
@iQueryNr 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].[Queries]
|
|
(
|
|
[QueryNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iQueryNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Queries_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Queries'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Queries_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[QueryNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Queries]
|
|
ORDER BY
|
|
[QueryNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Queries_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Queries'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iQueryNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Queries_SelectOne]
|
|
@iQueryNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[QueryNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Queries]
|
|
WHERE
|
|
[QueryNr] = @iQueryNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Queries_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Queries'
|
|
-- Gets: @iQueryNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Queries_Update]
|
|
@iQueryNr 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].[Queries]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[QueryNr] = @iQueryNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ReleaseArt_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ReleaseArt'
|
|
-- using the Primary Key.
|
|
-- Gets: @iReleaseartnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ReleaseArt_Delete]
|
|
@iReleaseartnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ReleaseArt]
|
|
WHERE
|
|
[Releaseartnr] = @iReleaseartnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ReleaseArt_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ReleaseArt'
|
|
-- Gets: @iReleaseartnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ReleaseArt_Insert]
|
|
@iReleaseartnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[ReleaseArt]
|
|
(
|
|
[Releaseartnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iReleaseartnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ReleaseArt_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ReleaseArt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ReleaseArt_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Releaseartnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ReleaseArt]
|
|
ORDER BY
|
|
[Releaseartnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ReleaseArt_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ReleaseArt'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iReleaseartnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ReleaseArt_SelectOne]
|
|
@iReleaseartnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Releaseartnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[ReleaseArt]
|
|
WHERE
|
|
[Releaseartnr] = @iReleaseartnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ReleaseArt_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ReleaseArt'
|
|
-- Gets: @iReleaseartnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ReleaseArt_Update]
|
|
@iReleaseartnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[ReleaseArt]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Releaseartnr] = @iReleaseartnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'RfcBoard'
|
|
-- using the Primary Key.
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Delete]
|
|
@iRfcBoardNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[RfcBoard]
|
|
WHERE
|
|
[RfcBoardNr] = @iRfcBoardNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'RfcBoard'
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Insert]
|
|
@iRfcBoardNr int,
|
|
@sBezeichnung varchar(50),
|
|
@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].[RfcBoard]
|
|
(
|
|
[RfcBoardNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iRfcBoardNr,
|
|
@sBezeichnung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Mitarbeiter_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'RfcBoard_Mitarbeiter'
|
|
-- using the Primary Key.
|
|
-- Gets: @iRfcBoard_Mitarbeiternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Mitarbeiter_Delete]
|
|
@iRfcBoard_Mitarbeiternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[RfcBoard_Mitarbeiter]
|
|
WHERE
|
|
[RfcBoard_Mitarbeiternr] = @iRfcBoard_Mitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Mitarbeiter_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'RfcBoard_Mitarbeiter'
|
|
-- Gets: @iRfcBoard_Mitarbeiternr int
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Gets: @iPersonnr int
|
|
-- Gets: @bLeiter bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Mitarbeiter_Insert]
|
|
@iRfcBoard_Mitarbeiternr int,
|
|
@iRfcBoardNr int,
|
|
@iPersonnr int,
|
|
@bLeiter bit,
|
|
@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].[RfcBoard_Mitarbeiter]
|
|
(
|
|
[RfcBoard_Mitarbeiternr],
|
|
[RfcBoardNr],
|
|
[Personnr],
|
|
[Leiter],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iRfcBoard_Mitarbeiternr,
|
|
@iRfcBoardNr,
|
|
@iPersonnr,
|
|
@bLeiter,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Mitarbeiter_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'RfcBoard_Mitarbeiter'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Mitarbeiter_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[RfcBoard_Mitarbeiternr],
|
|
[RfcBoardNr],
|
|
[Personnr],
|
|
[Leiter],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[RfcBoard_Mitarbeiter]
|
|
ORDER BY
|
|
[RfcBoard_Mitarbeiternr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rfcboard_mitarbeiter_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
/****** Objekt: StoredProcedure [dbo].[pr_rfcboard_mitarbeiter_SelectAll_Bottomtable] Skriptdatum: 03/31/2009 16:59:33 ******/
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'rfcbaord_mitarbeiter'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rfcboard_mitarbeiter_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.RfcBoard_Mitarbeiter.RfcBoard_Mitarbeiternr, dbo.RfcBoard_Mitarbeiter.RfcBoardNr, dbo.RfcBoard.Bezeichnung, dbo.RfcBoard_Mitarbeiter.Personnr,
|
|
dbo.Person.Name + ' ' + dbo.Person.Vorname AS Person, dbo.RfcBoard_Mitarbeiter.Leiter, dbo.RfcBoard_Mitarbeiter.Aktiv, dbo.RfcBoard_Mitarbeiter.Erstellt_am,
|
|
dbo.RfcBoard_Mitarbeiter.Mutiert_am, dbo.RfcBoard_Mitarbeiter.Mutierer
|
|
FROM dbo.RfcBoard INNER JOIN
|
|
dbo.RfcBoard_Mitarbeiter ON dbo.RfcBoard.RfcBoardNr = dbo.RfcBoard_Mitarbeiter.RfcBoardNr INNER JOIN
|
|
dbo.Person ON dbo.RfcBoard_Mitarbeiter.Personnr = dbo.Person.PersonNr
|
|
where dbo.rfcboard_mitarbeiter.rfcboardnr=@keyvalue
|
|
order by rfcboard_mitarbeiternr
|
|
end else begin
|
|
SELECT dbo.RfcBoard_Mitarbeiter.RfcBoard_Mitarbeiternr, dbo.RfcBoard_Mitarbeiter.RfcBoardNr, dbo.RfcBoard.Bezeichnung, dbo.RfcBoard_Mitarbeiter.Personnr,
|
|
dbo.Person.Name + ' ' + dbo.Person.Vorname AS Person, dbo.RfcBoard_Mitarbeiter.Leiter, dbo.RfcBoard_Mitarbeiter.Aktiv, dbo.RfcBoard_Mitarbeiter.Erstellt_am,
|
|
dbo.RfcBoard_Mitarbeiter.Mutiert_am, dbo.RfcBoard_Mitarbeiter.Mutierer
|
|
FROM dbo.RfcBoard INNER JOIN
|
|
dbo.RfcBoard_Mitarbeiter ON dbo.RfcBoard.RfcBoardNr = dbo.RfcBoard_Mitarbeiter.RfcBoardNr INNER JOIN
|
|
dbo.Person ON dbo.RfcBoard_Mitarbeiter.Personnr = dbo.Person.PersonNr
|
|
where dbo.rfcboard_mitarbeiter.personnr=@keyvalue
|
|
order by rfcboard_mitarbeiternr
|
|
end
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
/****** Objekt: StoredProcedure [dbo].[sp_applikation_get_vertragselemente] Skriptdatum: 03/31/2009 17:03:47 ******/
|
|
SET ANSI_NULLS ON
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Mitarbeiter_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'RfcBoard_Mitarbeiter'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iRfcBoard_Mitarbeiternr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Mitarbeiter_SelectOne]
|
|
@iRfcBoard_Mitarbeiternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[RfcBoard_Mitarbeiternr],
|
|
[RfcBoardNr],
|
|
[Personnr],
|
|
[Leiter],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[RfcBoard_Mitarbeiter]
|
|
WHERE
|
|
[RfcBoard_Mitarbeiternr] = @iRfcBoard_Mitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Mitarbeiter_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'RfcBoard_Mitarbeiter'
|
|
-- Gets: @iRfcBoard_Mitarbeiternr int
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Gets: @iPersonnr int
|
|
-- Gets: @bLeiter bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Mitarbeiter_Update]
|
|
@iRfcBoard_Mitarbeiternr int,
|
|
@iRfcBoardNr int,
|
|
@iPersonnr int,
|
|
@bLeiter bit,
|
|
@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].[RfcBoard_Mitarbeiter]
|
|
SET
|
|
[RfcBoardNr] = @iRfcBoardNr,
|
|
[Personnr] = @iPersonnr,
|
|
[Leiter] = @bLeiter,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[RfcBoard_Mitarbeiternr] = @iRfcBoard_Mitarbeiternr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'RfcBoard'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[RfcBoardNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[RfcBoard]
|
|
ORDER BY
|
|
[RfcBoardNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'RfcBoard'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_SelectOne]
|
|
@iRfcBoardNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[RfcBoardNr],
|
|
[Bezeichnung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[RfcBoard]
|
|
WHERE
|
|
[RfcBoardNr] = @iRfcBoardNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_RfcBoard_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'RfcBoard'
|
|
-- Gets: @iRfcBoardNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_RfcBoard_Update]
|
|
@iRfcBoardNr int,
|
|
@sBezeichnung varchar(50),
|
|
@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].[RfcBoard]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[RfcBoardNr] = @iRfcBoardNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'rolle'
|
|
-- using the Primary Key.
|
|
-- Gets: @irollenr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_Delete]
|
|
@irollenr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[rolle]
|
|
WHERE
|
|
[rollenr] = @irollenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'rolle'
|
|
-- Gets: @irollenr int
|
|
-- Gets: @sbezeichnung varchar(255)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @bsysadminrolle bit
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_Insert]
|
|
@irollenr int,
|
|
@sbezeichnung varchar(255),
|
|
@sbeschreibung varchar(255),
|
|
@bsysadminrolle bit,
|
|
@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].[rolle]
|
|
(
|
|
[rollenr],
|
|
[bezeichnung],
|
|
[beschreibung],
|
|
[sysadminrolle],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@irollenr,
|
|
@sbezeichnung,
|
|
@sbeschreibung,
|
|
@bsysadminrolle,
|
|
@imandantnr,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_securitylevel_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'rolle_securitylevel'
|
|
-- using the Primary Key.
|
|
-- Gets: @irolle_securitylevelnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_securitylevel_Delete]
|
|
@irolle_securitylevelnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[rolle_securitylevel]
|
|
WHERE
|
|
[rolle_securitylevelnr] = @irolle_securitylevelnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_securitylevel_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'rolle_securitylevel'
|
|
-- Gets: @irolle_securitylevelnr int
|
|
-- Gets: @irollenr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_securitylevel_Insert]
|
|
@irolle_securitylevelnr int,
|
|
@irollenr int,
|
|
@iSecurityLevelNr int,
|
|
@baktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[rolle_securitylevel]
|
|
(
|
|
[rolle_securitylevelnr],
|
|
[rollenr],
|
|
[SecurityLevelNr],
|
|
[aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@irolle_securitylevelnr,
|
|
@irollenr,
|
|
@iSecurityLevelNr,
|
|
@baktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_securitylevel_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'rolle_securitylevel'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_securitylevel_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[rolle_securitylevelnr],
|
|
[rollenr],
|
|
[SecurityLevelNr],
|
|
[aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[rolle_securitylevel]
|
|
ORDER BY
|
|
[rolle_securitylevelnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_securitylevel_selectall_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'pr_rolle_securitylevel_selectall_bottomtable'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
|
|
CREATE PROCEDURE [dbo].[pr_rolle_securitylevel_selectall_bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.rolle_securitylevel.rolle_securitylevelnr, dbo.rolle_securitylevel.rollenr, dbo.rolle.bezeichnung AS Rolle, dbo.rolle_securitylevel.SecurityLevelNr,
|
|
dbo.SecurityLevel.Bezeichnung AS SecurityLevel, dbo.rolle_securitylevel.aktiv, dbo.rolle_securitylevel.Erstellt_am,
|
|
dbo.rolle_securitylevel.Mutiert_am, dbo.rolle_securitylevel.Mutierer, dbo.rolle_securitylevel.Mandantnr
|
|
FROM dbo.rolle_securitylevel INNER JOIN
|
|
dbo.rolle ON dbo.rolle_securitylevel.rollenr = dbo.rolle.rollenr INNER JOIN
|
|
dbo.SecurityLevel ON dbo.rolle_securitylevel.SecurityLevelNr = dbo.SecurityLevel.SecurityLevelNr
|
|
where rolle_securitylevel.rollenr=@keyvalue
|
|
ORDER BY dbo.rolle_securitylevel.rolle_securitylevelnr
|
|
end else begin
|
|
SELECT dbo.rolle_securitylevel.rolle_securitylevelnr, dbo.rolle_securitylevel.rollenr, dbo.rolle.bezeichnung AS Rolle, dbo.rolle_securitylevel.SecurityLevelNr,
|
|
dbo.SecurityLevel.Bezeichnung AS SecurityLevel, dbo.rolle_securitylevel.aktiv, dbo.rolle_securitylevel.Erstellt_am,
|
|
dbo.rolle_securitylevel.Mutiert_am, dbo.rolle_securitylevel.Mutierer, dbo.rolle_securitylevel.Mandantnr
|
|
FROM dbo.rolle_securitylevel INNER JOIN
|
|
dbo.rolle ON dbo.rolle_securitylevel.rollenr = dbo.rolle.rollenr INNER JOIN
|
|
dbo.SecurityLevel ON dbo.rolle_securitylevel.SecurityLevelNr = dbo.SecurityLevel.SecurityLevelNr
|
|
where rolle_securitylevel.securitylevelnr=@keyvalue
|
|
ORDER BY dbo.rolle_securitylevel.rolle_securitylevelnr
|
|
end
|
|
-- SELECT all rows from the table.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_securitylevel_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'rolle_securitylevel'
|
|
-- based on the Primary Key.
|
|
-- Gets: @irolle_securitylevelnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_securitylevel_SelectOne]
|
|
@irolle_securitylevelnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[rolle_securitylevelnr],
|
|
[rollenr],
|
|
[SecurityLevelNr],
|
|
[aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[rolle_securitylevel]
|
|
WHERE
|
|
[rolle_securitylevelnr] = @irolle_securitylevelnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_securitylevel_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'rolle_securitylevel'
|
|
-- Gets: @irolle_securitylevelnr int
|
|
-- Gets: @irollenr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_securitylevel_Update]
|
|
@irolle_securitylevelnr int,
|
|
@irollenr int,
|
|
@iSecurityLevelNr int,
|
|
@baktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[rolle_securitylevel]
|
|
SET
|
|
[rollenr] = @irollenr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[aktiv] = @baktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[rolle_securitylevelnr] = @irolle_securitylevelnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Rolle_SecurityObject_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Rolle_SecurityObject'
|
|
-- using the Primary Key.
|
|
-- Gets: @irolle_securityobjectnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Rolle_SecurityObject_Delete]
|
|
@irolle_securityobjectnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Rolle_SecurityObject]
|
|
WHERE
|
|
[rolle_securityobjectnr] = @irolle_securityobjectnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Rolle_SecurityObject_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Rolle_SecurityObject'
|
|
-- Gets: @irolle_securityobjectnr int
|
|
-- Gets: @irollenr int
|
|
-- Gets: @isecurityobjectnr int
|
|
-- Gets: @breadonly bit
|
|
-- Gets: @binvisible bit
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @imandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Rolle_SecurityObject_Insert]
|
|
@irolle_securityobjectnr int,
|
|
@irollenr int,
|
|
@isecurityobjectnr int,
|
|
@breadonly bit,
|
|
@binvisible bit,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@imandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Rolle_SecurityObject]
|
|
(
|
|
[rolle_securityobjectnr],
|
|
[rollenr],
|
|
[securityobjectnr],
|
|
[readonly],
|
|
[invisible],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@irolle_securityobjectnr,
|
|
@irollenr,
|
|
@isecurityobjectnr,
|
|
@breadonly,
|
|
@binvisible,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@imandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Rolle_SecurityObject_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Rolle_SecurityObject'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Rolle_SecurityObject_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[rolle_securityobjectnr],
|
|
[rollenr],
|
|
[securityobjectnr],
|
|
[readonly],
|
|
[invisible],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr]
|
|
FROM [dbo].[Rolle_SecurityObject]
|
|
ORDER BY
|
|
[rolle_securityobjectnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_SecurityObject_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_SecurityObject_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.Rolle_SecurityObject.rolle_securityobjectnr, dbo.Rolle_SecurityObject.rollenr, dbo.rolle.bezeichnung AS Rolle, dbo.Rolle_SecurityObject.securityobjectnr,
|
|
dbo.SecurityObject.SecurityForm + '|' + dbo.SecurityObject.SecurityObject + '|' + dbo.SecurityObject.SecurityObjectItem AS SecurityObjectBez,
|
|
dbo.Rolle_SecurityObject.readonly, dbo.Rolle_SecurityObject.invisible, dbo.Rolle_SecurityObject.aktiv, dbo.Rolle_SecurityObject.erstellt_am,
|
|
dbo.Rolle_SecurityObject.mutiert_am, dbo.Rolle_SecurityObject.mutierer, dbo.Rolle_SecurityObject.mandantnr
|
|
FROM dbo.rolle INNER JOIN
|
|
dbo.Rolle_SecurityObject ON dbo.rolle.rollenr = dbo.Rolle_SecurityObject.rollenr INNER JOIN
|
|
dbo.SecurityObject ON dbo.Rolle_SecurityObject.securityobjectnr = dbo.SecurityObject.SecurityObjectNr
|
|
WHERE (dbo.Rolle_SecurityObject.rollenr = @keyvalue)
|
|
ORDER BY dbo.Rolle_SecurityObject.rolle_securityobjectnr
|
|
end else begin
|
|
SELECT dbo.Rolle_SecurityObject.rolle_securityobjectnr, dbo.Rolle_SecurityObject.rollenr, dbo.rolle.bezeichnung AS Rolle, dbo.Rolle_SecurityObject.securityobjectnr,
|
|
dbo.SecurityObject.SecurityForm + '|' + dbo.SecurityObject.SecurityObject + '|' + dbo.SecurityObject.SecurityObjectItem AS SecurityObject,
|
|
dbo.Rolle_SecurityObject.readonly, dbo.Rolle_SecurityObject.invisible, dbo.Rolle_SecurityObject.aktiv, dbo.Rolle_SecurityObject.erstellt_am,
|
|
dbo.Rolle_SecurityObject.mutiert_am, dbo.Rolle_SecurityObject.mutierer, dbo.Rolle_SecurityObject.mandantnr
|
|
FROM dbo.rolle INNER JOIN
|
|
dbo.Rolle_SecurityObject ON dbo.rolle.rollenr = dbo.Rolle_SecurityObject.rollenr INNER JOIN
|
|
dbo.SecurityObject ON dbo.Rolle_SecurityObject.securityobjectnr = dbo.SecurityObject.SecurityObjectNr
|
|
WHERE (dbo.Rolle_SecurityObject.SecurityObjectNr = @keyvalue)
|
|
ORDER BY dbo.Rolle_SecurityObject.rolle_securityobjectnr
|
|
end
|
|
-- SELECT all rows from the table.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Rolle_SecurityObject_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Rolle_SecurityObject'
|
|
-- based on the Primary Key.
|
|
-- Gets: @irolle_securityobjectnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Rolle_SecurityObject_SelectOne]
|
|
@irolle_securityobjectnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[rolle_securityobjectnr],
|
|
[rollenr],
|
|
[securityobjectnr],
|
|
[readonly],
|
|
[invisible],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr]
|
|
FROM [dbo].[Rolle_SecurityObject]
|
|
WHERE
|
|
[rolle_securityobjectnr] = @irolle_securityobjectnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Rolle_SecurityObject_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Rolle_SecurityObject'
|
|
-- Gets: @irolle_securityobjectnr int
|
|
-- Gets: @irollenr int
|
|
-- Gets: @isecurityobjectnr int
|
|
-- Gets: @breadonly bit
|
|
-- Gets: @binvisible bit
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @imandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Rolle_SecurityObject_Update]
|
|
@irolle_securityobjectnr int,
|
|
@irollenr int,
|
|
@isecurityobjectnr int,
|
|
@breadonly bit,
|
|
@binvisible bit,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@imandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Rolle_SecurityObject]
|
|
SET
|
|
[rollenr] = @irollenr,
|
|
[securityobjectnr] = @isecurityobjectnr,
|
|
[readonly] = @breadonly,
|
|
[invisible] = @binvisible,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[mandantnr] = @imandantnr
|
|
WHERE
|
|
[rolle_securityobjectnr] = @irolle_securityobjectnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[rollenr],
|
|
[bezeichnung],
|
|
[beschreibung],
|
|
[sysadminrolle],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[rolle]
|
|
ORDER BY
|
|
[rollenr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'rolle'
|
|
-- based on the Primary Key.
|
|
-- Gets: @irollenr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_SelectOne]
|
|
@irollenr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[rollenr],
|
|
[bezeichnung],
|
|
[beschreibung],
|
|
[sysadminrolle],
|
|
[mandantnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer]
|
|
FROM [dbo].[rolle]
|
|
WHERE
|
|
[rollenr] = @irollenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_sysadminfunktion_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'rolle_sysadminfunktion'
|
|
-- using the Primary Key.
|
|
-- Gets: @irolle_sysadminfnktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_sysadminfunktion_Delete]
|
|
@irolle_sysadminfnktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[rolle_sysadminfunktion]
|
|
WHERE
|
|
[rolle_sysadminfnktnr] = @irolle_sysadminfnktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_sysadminfunktion_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'rolle_sysadminfunktion'
|
|
-- Gets: @irolle_sysadminfnktnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @isysadminfnktnr int
|
|
-- Gets: @irollenr int
|
|
-- Gets: @imandant int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_sysadminfunktion_Insert]
|
|
@irolle_sysadminfnktnr int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@isysadminfnktnr int,
|
|
@irollenr int,
|
|
@imandant int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[rolle_sysadminfunktion]
|
|
(
|
|
[rolle_sysadminfnktnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[sysadminfnktnr],
|
|
[rollenr],
|
|
[mandant]
|
|
)
|
|
VALUES
|
|
(
|
|
@irolle_sysadminfnktnr,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@isysadminfnktnr,
|
|
@irollenr,
|
|
@imandant
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_sysadminfunktion_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'rolle_sysadminfunktion'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_sysadminfunktion_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[rolle_sysadminfnktnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[sysadminfnktnr],
|
|
[rollenr],
|
|
[mandant]
|
|
FROM [dbo].[rolle_sysadminfunktion]
|
|
ORDER BY
|
|
[rolle_sysadminfnktnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_sysadminfunktion_SelectAll_BottomTable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'rolle_sysadminfunktion'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_sysadminfunktion_SelectAll_BottomTable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.rolle_sysadminfunktion.rolle_sysadminfnktnr, dbo.rolle_sysadminfunktion.sysadminfnktnr,
|
|
dbo.sysadminfunktion.bezeichnung AS sysadminfunktion, dbo.rolle_sysadminfunktion.rollenr, dbo.rolle.bezeichnung AS Rolle,
|
|
dbo.rolle_sysadminfunktion.aktiv, dbo.rolle_sysadminfunktion.erstellt_am, dbo.rolle_sysadminfunktion.mutiert_am,
|
|
dbo.rolle_sysadminfunktion.mutierer, dbo.rolle_sysadminfunktion.mandant
|
|
FROM dbo.rolle_sysadminfunktion INNER JOIN
|
|
dbo.rolle ON dbo.rolle_sysadminfunktion.rollenr = dbo.rolle.rollenr INNER JOIN
|
|
dbo.sysadminfunktion ON dbo.rolle_sysadminfunktion.sysadminfnktnr = dbo.sysadminfunktion.sysadminfnktnr
|
|
where rolle_sysadminfunktion.rollenr=@keyvalue
|
|
ORDER BY dbo.rolle_sysadminfunktion.rolle_sysadminfnktnr
|
|
end else begin
|
|
SELECT dbo.rolle_sysadminfunktion.rolle_sysadminfnktnr, dbo.rolle_sysadminfunktion.sysadminfnktnr,
|
|
dbo.sysadminfunktion.bezeichnung AS sysadminfunktion, dbo.rolle_sysadminfunktion.rollenr, dbo.rolle.bezeichnung AS Rolle,
|
|
dbo.rolle_sysadminfunktion.aktiv, dbo.rolle_sysadminfunktion.erstellt_am, dbo.rolle_sysadminfunktion.mutiert_am,
|
|
dbo.rolle_sysadminfunktion.mutierer, dbo.rolle_sysadminfunktion.mandant
|
|
FROM dbo.rolle_sysadminfunktion INNER JOIN
|
|
dbo.rolle ON dbo.rolle_sysadminfunktion.rollenr = dbo.rolle.rollenr INNER JOIN
|
|
dbo.sysadminfunktion ON dbo.rolle_sysadminfunktion.sysadminfnktnr = dbo.sysadminfunktion.sysadminfnktnr
|
|
where rolle_sysadminfunktion.sysadminfnktnr=@keyvalue
|
|
ORDER BY dbo.rolle_sysadminfunktion.rolle_sysadminfnktnr
|
|
end
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_sysadminfunktion_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'rolle_sysadminfunktion'
|
|
-- based on the Primary Key.
|
|
-- Gets: @irolle_sysadminfnktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_sysadminfunktion_SelectOne]
|
|
@irolle_sysadminfnktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[rolle_sysadminfnktnr],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[sysadminfnktnr],
|
|
[rollenr],
|
|
[mandant]
|
|
FROM [dbo].[rolle_sysadminfunktion]
|
|
WHERE
|
|
[rolle_sysadminfnktnr] = @irolle_sysadminfnktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_sysadminfunktion_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'rolle_sysadminfunktion'
|
|
-- Gets: @irolle_sysadminfnktnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @isysadminfnktnr int
|
|
-- Gets: @irollenr int
|
|
-- Gets: @imandant int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_sysadminfunktion_Update]
|
|
@irolle_sysadminfnktnr int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@isysadminfnktnr int,
|
|
@irollenr int,
|
|
@imandant int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[rolle_sysadminfunktion]
|
|
SET
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[sysadminfnktnr] = @isysadminfnktnr,
|
|
[rollenr] = @irollenr,
|
|
[mandant] = @imandant
|
|
WHERE
|
|
[rolle_sysadminfnktnr] = @irolle_sysadminfnktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_rolle_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'rolle'
|
|
-- Gets: @irollenr int
|
|
-- Gets: @sbezeichnung varchar(255)
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @bsysadminrolle bit
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_rolle_Update]
|
|
@irollenr int,
|
|
@sbezeichnung varchar(255),
|
|
@sbeschreibung varchar(255),
|
|
@bsysadminrolle bit,
|
|
@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].[rolle]
|
|
SET
|
|
[bezeichnung] = @sbezeichnung,
|
|
[beschreibung] = @sbeschreibung,
|
|
[sysadminrolle] = @bsysadminrolle,
|
|
[mandantnr] = @imandantnr,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer
|
|
WHERE
|
|
[rollenr] = @irollenr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDAdministrator_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SDAdministrator'
|
|
-- Gets: @iSDAdministratorNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SDAdministrator_Insert]
|
|
@iSDAdministratorNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[SDAdministrator]
|
|
(
|
|
[SDAdministratorNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSDAdministratorNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDAdministrator_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SDAdministrator'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SDAdministrator_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SDAdministratorNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[SDAdministrator]
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDAdministrator_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[pr_SDAdministrator_SelectOne]
|
|
@iSDAdministratorNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SDAdministratorNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[SDAdministrator]
|
|
WHERE
|
|
[SDAdministratorNr] = @iSDAdministratorNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDAdministrator_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[pr_SDAdministrator_Update]
|
|
@iSDAdministratorNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[SDAdministrator]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[SDAdministratorNr] = @iSDAdministratorNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDDaten_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'SDDaten'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSDDatenNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SDDaten_Delete]
|
|
@iSDDatenNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[SDDaten]
|
|
WHERE
|
|
[SDDatenNr] = @iSDDatenNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDDaten_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SDDaten'
|
|
-- Gets: @iSDDatenNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SDDaten_Insert]
|
|
@iSDDatenNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[SDDaten]
|
|
(
|
|
[SDDatenNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSDDatenNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDDaten_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SDDaten'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SDDaten_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SDDatenNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[SDDaten]
|
|
ORDER BY
|
|
[SDDatenNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDDaten_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'SDDaten'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSDDatenNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SDDaten_SelectOne]
|
|
@iSDDatenNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SDDatenNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[SDDaten]
|
|
WHERE
|
|
[SDDatenNr] = @iSDDatenNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SDDaten_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'SDDaten'
|
|
-- Gets: @iSDDatenNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SDDaten_Update]
|
|
@iSDDatenNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung 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].[SDDaten]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[SDDatenNr] = @iSDDatenNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Form_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Security_Form'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSecurityFormNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Form_Delete]
|
|
@iSecurityFormNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Security_Form]
|
|
WHERE
|
|
[SecurityFormNr] = @iSecurityFormNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Form_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Security_Form'
|
|
-- Gets: @iSecurityFormNr int
|
|
-- Gets: @sSecurityFormBezeichnung varchar(50)
|
|
-- Gets: @sSecurityFormName char(10)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sMandantnr char(10)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Form_Insert]
|
|
@iSecurityFormNr int,
|
|
@sSecurityFormBezeichnung varchar(50),
|
|
@sSecurityFormName char(10),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sMandantnr char(10),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Security_Form]
|
|
(
|
|
[SecurityFormNr],
|
|
[SecurityFormBezeichnung],
|
|
[SecurityFormName],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSecurityFormNr,
|
|
@sSecurityFormBezeichnung,
|
|
@sSecurityFormName,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@sMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Form_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Security_Form'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Form_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SecurityFormNr],
|
|
[SecurityFormBezeichnung],
|
|
[SecurityFormName],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Security_Form]
|
|
ORDER BY
|
|
[SecurityFormNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Form_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Security_Form'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSecurityFormNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Form_SelectOne]
|
|
@iSecurityFormNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SecurityFormNr],
|
|
[SecurityFormBezeichnung],
|
|
[SecurityFormName],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Security_Form]
|
|
WHERE
|
|
[SecurityFormNr] = @iSecurityFormNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Form_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Security_Form'
|
|
-- Gets: @iSecurityFormNr int
|
|
-- Gets: @sSecurityFormBezeichnung varchar(50)
|
|
-- Gets: @sSecurityFormName char(10)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sMandantnr char(10)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Form_Update]
|
|
@iSecurityFormNr int,
|
|
@sSecurityFormBezeichnung varchar(50),
|
|
@sSecurityFormName char(10),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sMandantnr char(10),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Security_Form]
|
|
SET
|
|
[SecurityFormBezeichnung] = @sSecurityFormBezeichnung,
|
|
[SecurityFormName] = @sSecurityFormName,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @sMandantnr
|
|
WHERE
|
|
[SecurityFormNr] = @iSecurityFormNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Object_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Security_Object'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSecuritObjektNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Object_Delete]
|
|
@iSecuritObjektNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Security_Object]
|
|
WHERE
|
|
[SecuritObjektNr] = @iSecuritObjektNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Object_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Security_Object'
|
|
-- Gets: @iSecuritObjektNr int
|
|
-- Gets: @iSecurityFormNr int
|
|
-- Gets: @sSecurityObject varchar(50)
|
|
-- Gets: @sSecurityObjectItem varchar(50)
|
|
-- Gets: @bReadonly bit
|
|
-- Gets: @bInVisible bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sMandantnr char(10)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Object_Insert]
|
|
@iSecuritObjektNr int,
|
|
@iSecurityFormNr int,
|
|
@sSecurityObject varchar(50),
|
|
@sSecurityObjectItem varchar(50),
|
|
@bReadonly bit,
|
|
@bInVisible bit,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sMandantnr char(10),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Security_Object]
|
|
(
|
|
[SecuritObjektNr],
|
|
[SecurityFormNr],
|
|
[SecurityObject],
|
|
[SecurityObjectItem],
|
|
[Readonly],
|
|
[InVisible],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSecuritObjektNr,
|
|
@iSecurityFormNr,
|
|
@sSecurityObject,
|
|
@sSecurityObjectItem,
|
|
@bReadonly,
|
|
@bInVisible,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@sMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Object_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Security_Object'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Object_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SecuritObjektNr],
|
|
[SecurityFormNr],
|
|
[SecurityObject],
|
|
[SecurityObjectItem],
|
|
[Readonly],
|
|
[InVisible],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Security_Object]
|
|
ORDER BY
|
|
[SecuritObjektNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Object_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Security_Object'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSecuritObjektNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Object_SelectOne]
|
|
@iSecuritObjektNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SecuritObjektNr],
|
|
[SecurityFormNr],
|
|
[SecurityObject],
|
|
[SecurityObjectItem],
|
|
[Readonly],
|
|
[InVisible],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Security_Object]
|
|
WHERE
|
|
[SecuritObjektNr] = @iSecuritObjektNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Security_Object_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Security_Object'
|
|
-- Gets: @iSecuritObjektNr int
|
|
-- Gets: @iSecurityFormNr int
|
|
-- Gets: @sSecurityObject varchar(50)
|
|
-- Gets: @sSecurityObjectItem varchar(50)
|
|
-- Gets: @bReadonly bit
|
|
-- Gets: @bInVisible bit
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @sMandantnr char(10)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Security_Object_Update]
|
|
@iSecuritObjektNr int,
|
|
@iSecurityFormNr int,
|
|
@sSecurityObject varchar(50),
|
|
@sSecurityObjectItem varchar(50),
|
|
@bReadonly bit,
|
|
@bInVisible bit,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@sMandantnr char(10),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Security_Object]
|
|
SET
|
|
[SecurityFormNr] = @iSecurityFormNr,
|
|
[SecurityObject] = @sSecurityObject,
|
|
[SecurityObjectItem] = @sSecurityObjectItem,
|
|
[Readonly] = @bReadonly,
|
|
[InVisible] = @bInVisible,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @sMandantnr
|
|
WHERE
|
|
[SecuritObjektNr] = @iSecuritObjektNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityLevel_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'SecurityLevel'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityLevel_Delete]
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[SecurityLevel]
|
|
WHERE
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityLevel_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SecurityLevel'
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityLevel_Insert]
|
|
@iSecurityLevelNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[SecurityLevel]
|
|
(
|
|
[SecurityLevelNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSecurityLevelNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityLevel_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SecurityLevel'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityLevel_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SecurityLevelNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SecurityLevel]
|
|
ORDER BY
|
|
[SecurityLevelNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityLevel_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'SecurityLevel'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityLevel_SelectOne]
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SecurityLevelNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SecurityLevel]
|
|
WHERE
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityLevel_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'SecurityLevel'
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityLevel_Update]
|
|
@iSecurityLevelNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[SecurityLevel]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityObject_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'SecurityObject'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSecurityObjectNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityObject_Delete]
|
|
@iSecurityObjectNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[SecurityObject]
|
|
WHERE
|
|
[SecurityObjectNr] = @iSecurityObjectNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityObject_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SecurityObject'
|
|
-- Gets: @iSecurityObjectNr int
|
|
-- Gets: @sSecurityForm varchar(50)
|
|
-- Gets: @sSecurityObjectType varchar(50)
|
|
-- Gets: @sSecurityObject varchar(50)
|
|
-- Gets: @sSecurityObjectItem varchar(50)
|
|
-- Gets: @sSecurityObjectDescriotion varchar(50)
|
|
-- Gets: @iLevel int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityObject_Insert]
|
|
@iSecurityObjectNr int,
|
|
@sSecurityForm varchar(50),
|
|
@sSecurityObjectType varchar(50),
|
|
@sSecurityObject varchar(50),
|
|
@sSecurityObjectItem varchar(50),
|
|
@sSecurityObjectDescriotion varchar(50),
|
|
@iLevel int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[SecurityObject]
|
|
(
|
|
[SecurityObjectNr],
|
|
[SecurityForm],
|
|
[SecurityObjectType],
|
|
[SecurityObject],
|
|
[SecurityObjectItem],
|
|
[SecurityObjectDescriotion],
|
|
[Level],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSecurityObjectNr,
|
|
@sSecurityForm,
|
|
@sSecurityObjectType,
|
|
@sSecurityObject,
|
|
@sSecurityObjectItem,
|
|
@sSecurityObjectDescriotion,
|
|
@iLevel,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityObject_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SecurityObject'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityObject_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SecurityObjectNr],
|
|
[SecurityForm],
|
|
[SecurityObjectType],
|
|
[SecurityObject],
|
|
[SecurityObjectItem],
|
|
[SecurityObjectDescriotion],
|
|
[Level],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SecurityObject]
|
|
ORDER BY
|
|
[SecurityObjectNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityObject_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'SecurityObject'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSecurityObjectNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityObject_SelectOne]
|
|
@iSecurityObjectNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SecurityObjectNr],
|
|
[SecurityForm],
|
|
[SecurityObjectType],
|
|
[SecurityObject],
|
|
[SecurityObjectItem],
|
|
[SecurityObjectDescriotion],
|
|
[Level],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SecurityObject]
|
|
WHERE
|
|
[SecurityObjectNr] = @iSecurityObjectNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SecurityObject_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'SecurityObject'
|
|
-- Gets: @iSecurityObjectNr int
|
|
-- Gets: @sSecurityForm varchar(50)
|
|
-- Gets: @sSecurityObjectType varchar(50)
|
|
-- Gets: @sSecurityObject varchar(50)
|
|
-- Gets: @sSecurityObjectItem varchar(50)
|
|
-- Gets: @sSecurityObjectDescriotion varchar(50)
|
|
-- Gets: @iLevel int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SecurityObject_Update]
|
|
@iSecurityObjectNr int,
|
|
@sSecurityForm varchar(50),
|
|
@sSecurityObjectType varchar(50),
|
|
@sSecurityObject varchar(50),
|
|
@sSecurityObjectItem varchar(50),
|
|
@sSecurityObjectDescriotion varchar(50),
|
|
@iLevel int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[SecurityObject]
|
|
SET
|
|
[SecurityForm] = @sSecurityForm,
|
|
[SecurityObjectType] = @sSecurityObjectType,
|
|
[SecurityObject] = @sSecurityObject,
|
|
[SecurityObjectItem] = @sSecurityObjectItem,
|
|
[SecurityObjectDescriotion] = @sSecurityObjectDescriotion,
|
|
[Level] = @iLevel,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[SecurityObjectNr] = @iSecurityObjectNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Loesung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Backup_Loesung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_Backup_LoesungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Loesung_Delete]
|
|
@iServer_Backup_LoesungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Backup_Loesung]
|
|
WHERE
|
|
[Server_Backup_LoesungNr] = @iServer_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Loesung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Backup_Loesung'
|
|
-- Gets: @iServer_Backup_LoesungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Loesung_Insert]
|
|
@iServer_Backup_LoesungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Backup_Loesung]
|
|
(
|
|
[Server_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_Backup_LoesungNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Loesung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Backup_Loesung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Loesung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Backup_Loesung]
|
|
ORDER BY
|
|
[Server_Backup_LoesungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Loesung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Backup_Loesung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_Backup_LoesungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Loesung_SelectOne]
|
|
@iServer_Backup_LoesungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Backup_Loesung]
|
|
WHERE
|
|
[Server_Backup_LoesungNr] = @iServer_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Loesung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Backup_Loesung'
|
|
-- Gets: @iServer_Backup_LoesungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Loesung_Update]
|
|
@iServer_Backup_LoesungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Backup_Loesung]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_Backup_LoesungNr] = @iServer_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Retention_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Backup_Retention'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_Backup_RetentionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Retention_Delete]
|
|
@iServer_Backup_RetentionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Backup_Retention]
|
|
WHERE
|
|
[Server_Backup_RetentionNr] = @iServer_Backup_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Retention_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Backup_Retention'
|
|
-- Gets: @iServer_Backup_RetentionNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Retention_Insert]
|
|
@iServer_Backup_RetentionNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Backup_Retention]
|
|
(
|
|
[Server_Backup_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_Backup_RetentionNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Retention_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Backup_Retention'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Retention_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_Backup_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Backup_Retention]
|
|
ORDER BY
|
|
[Server_Backup_RetentionNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Retention_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Backup_Retention'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_Backup_RetentionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Retention_SelectOne]
|
|
@iServer_Backup_RetentionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_Backup_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Backup_Retention]
|
|
WHERE
|
|
[Server_Backup_RetentionNr] = @iServer_Backup_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Backup_Retention_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Backup_Retention'
|
|
-- Gets: @iServer_Backup_RetentionNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Backup_Retention_Update]
|
|
@iServer_Backup_RetentionNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Backup_Retention]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_Backup_RetentionNr] = @iServer_Backup_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Loesung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_DB_Backup_Loesung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_DB_Backup_LoesungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Loesung_Delete]
|
|
@iServer_DB_Backup_LoesungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_DB_Backup_Loesung]
|
|
WHERE
|
|
[Server_DB_Backup_LoesungNr] = @iServer_DB_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Loesung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_DB_Backup_Loesung'
|
|
-- Gets: @iServer_DB_Backup_LoesungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Loesung_Insert]
|
|
@iServer_DB_Backup_LoesungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_DB_Backup_Loesung]
|
|
(
|
|
[Server_DB_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_DB_Backup_LoesungNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Loesung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_DB_Backup_Loesung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Loesung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_DB_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_DB_Backup_Loesung]
|
|
ORDER BY
|
|
[Server_DB_Backup_LoesungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Loesung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_DB_Backup_Loesung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_DB_Backup_LoesungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Loesung_SelectOne]
|
|
@iServer_DB_Backup_LoesungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_DB_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_DB_Backup_Loesung]
|
|
WHERE
|
|
[Server_DB_Backup_LoesungNr] = @iServer_DB_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Loesung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_DB_Backup_Loesung'
|
|
-- Gets: @iServer_DB_Backup_LoesungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Loesung_Update]
|
|
@iServer_DB_Backup_LoesungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_DB_Backup_Loesung]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_DB_Backup_LoesungNr] = @iServer_DB_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Retention_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_DB_Backup_Retention'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_DB_Backup_RetentionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Retention_Delete]
|
|
@iServer_DB_Backup_RetentionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_DB_Backup_Retention]
|
|
WHERE
|
|
[Server_DB_Backup_RetentionNr] = @iServer_DB_Backup_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Retention_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_DB_Backup_Retention'
|
|
-- Gets: @iServer_DB_Backup_RetentionNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Retention_Insert]
|
|
@iServer_DB_Backup_RetentionNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_DB_Backup_Retention]
|
|
(
|
|
[Server_DB_Backup_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_DB_Backup_RetentionNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Retention_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_DB_Backup_Retention'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Retention_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_DB_Backup_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_DB_Backup_Retention]
|
|
ORDER BY
|
|
[Server_DB_Backup_RetentionNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Retention_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_DB_Backup_Retention'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_DB_Backup_RetentionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Retention_SelectOne]
|
|
@iServer_DB_Backup_RetentionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_DB_Backup_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_DB_Backup_Retention]
|
|
WHERE
|
|
[Server_DB_Backup_RetentionNr] = @iServer_DB_Backup_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Backup_Retention_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_DB_Backup_Retention'
|
|
-- Gets: @iServer_DB_Backup_RetentionNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Backup_Retention_Update]
|
|
@iServer_DB_Backup_RetentionNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_DB_Backup_Retention]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_DB_Backup_RetentionNr] = @iServer_DB_Backup_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_DB'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_DBNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Delete]
|
|
@iServer_DBNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_DB]
|
|
WHERE
|
|
[Server_DBNr] = @iServer_DBNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_DB'
|
|
-- Gets: @iServer_DBNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Insert]
|
|
@iServer_DBNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_DB]
|
|
(
|
|
[Server_DBNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_DBNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_DB'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_DBNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_DB]
|
|
ORDER BY
|
|
[Server_DBNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_DB'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_DBNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_SelectOne]
|
|
@iServer_DBNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_DBNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_DB]
|
|
WHERE
|
|
[Server_DBNr] = @iServer_DBNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_DB_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_DB'
|
|
-- Gets: @iServer_DBNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_DB_Update]
|
|
@iServer_DBNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_DB]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_DBNr] = @iServer_DBNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Inventar_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Inventar'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServerInventarNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Inventar_Delete]
|
|
@iServerInventarNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Inventar]
|
|
WHERE
|
|
[ServerInventarNr] = @iServerInventarNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Inventar_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Inventar'
|
|
-- Gets: @iServerInventarNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iServer_UmgebungNr int
|
|
-- Gets: @iServer_KategorieNr int
|
|
-- Gets: @iServer_OSNr int
|
|
-- Gets: @iServer_OSLevelNr int
|
|
-- Gets: @sBemerkung_OS varchar(1024)
|
|
-- Gets: @iServer_Backup_LoesungNr int
|
|
-- Gets: @iServer_Backup_RetentionNr int
|
|
-- Gets: @sServer_Backup_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_DBNr int
|
|
-- Gets: @sServer_DB_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_DB_Backup_LoesungNr int
|
|
-- Gets: @iServer_DB_Backup_RetentionNr int
|
|
-- Gets: @sServer_DB_Backup_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_StandortNr int
|
|
-- Gets: @sServer_Stanmdort_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_Weiteres_TypNr1 int
|
|
-- Gets: @iServer_Weiteres_TypNr2 int
|
|
-- Gets: @iServer_Weiteres_TypNr3 int
|
|
-- Gets: @iServer_Weiteres_TypNr4 int
|
|
-- Gets: @iServer_Weiteres_TypNr5 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr1 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr2 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr3 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr4 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr5 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr1 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr2 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr3 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr4 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr5 int
|
|
-- Gets: @sServer_Weiteres_Bemerkung1 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung2 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung3 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung4 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung5 varchar(1024)
|
|
-- Gets: @iServer_ProviderNr int
|
|
-- Gets: @sRZ_Betreiber_Standort varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Inventar_Insert]
|
|
@iServerInventarNr int,
|
|
@iParentID int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iServer_UmgebungNr int,
|
|
@iServer_KategorieNr int,
|
|
@iServer_OSNr int,
|
|
@iServer_OSLevelNr int,
|
|
@sBemerkung_OS varchar(1024),
|
|
@iServer_Backup_LoesungNr int,
|
|
@iServer_Backup_RetentionNr int,
|
|
@sServer_Backup_Bemerkung varchar(1024),
|
|
@iServer_DBNr int,
|
|
@sServer_DB_Bemerkung varchar(1024),
|
|
@iServer_DB_Backup_LoesungNr int,
|
|
@iServer_DB_Backup_RetentionNr int,
|
|
@sServer_DB_Backup_Bemerkung varchar(1024),
|
|
@iServer_StandortNr int,
|
|
@sServer_Stanmdort_Bemerkung varchar(1024),
|
|
@iServer_Weiteres_TypNr1 int,
|
|
@iServer_Weiteres_TypNr2 int,
|
|
@iServer_Weiteres_TypNr3 int,
|
|
@iServer_Weiteres_TypNr4 int,
|
|
@iServer_Weiteres_TypNr5 int,
|
|
@iServer_Weiteres_Backup_LoesungNr1 int,
|
|
@iServer_Weiteres_Backup_LoesungNr2 int,
|
|
@iServer_Weiteres_Backup_LoesungNr3 int,
|
|
@iServer_Weiteres_Backup_LoesungNr4 int,
|
|
@iServer_Weiteres_Backup_LoesungNr5 int,
|
|
@iServer_Weiteres_RetentionNr1 int,
|
|
@iServer_Weiteres_RetentionNr2 int,
|
|
@iServer_Weiteres_RetentionNr3 int,
|
|
@iServer_Weiteres_RetentionNr4 int,
|
|
@iServer_Weiteres_RetentionNr5 int,
|
|
@sServer_Weiteres_Bemerkung1 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung2 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung3 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung4 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung5 varchar(1024),
|
|
@iServer_ProviderNr int,
|
|
@sRZ_Betreiber_Standort varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Server_Inventar]
|
|
(
|
|
[ServerInventarNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Server_UmgebungNr],
|
|
[Server_KategorieNr],
|
|
[Server_OSNr],
|
|
[Server_OSLevelNr],
|
|
[Bemerkung_OS],
|
|
[Server_Backup_LoesungNr],
|
|
[Server_Backup_RetentionNr],
|
|
[Server_Backup_Bemerkung],
|
|
[Server_DBNr],
|
|
[Server_DB_Bemerkung],
|
|
[Server_DB_Backup_LoesungNr],
|
|
[Server_DB_Backup_RetentionNr],
|
|
[Server_DB_Backup_Bemerkung],
|
|
[Server_StandortNr],
|
|
[Server_Stanmdort_Bemerkung],
|
|
[Server_Weiteres_TypNr1],
|
|
[Server_Weiteres_TypNr2],
|
|
[Server_Weiteres_TypNr3],
|
|
[Server_Weiteres_TypNr4],
|
|
[Server_Weiteres_TypNr5],
|
|
[Server_Weiteres_Backup_LoesungNr1],
|
|
[Server_Weiteres_Backup_LoesungNr2],
|
|
[Server_Weiteres_Backup_LoesungNr3],
|
|
[Server_Weiteres_Backup_LoesungNr4],
|
|
[Server_Weiteres_Backup_LoesungNr5],
|
|
[Server_Weiteres_RetentionNr1],
|
|
[Server_Weiteres_RetentionNr2],
|
|
[Server_Weiteres_RetentionNr3],
|
|
[Server_Weiteres_RetentionNr4],
|
|
[Server_Weiteres_RetentionNr5],
|
|
[Server_Weiteres_Bemerkung1],
|
|
[Server_Weiteres_Bemerkung2],
|
|
[Server_Weiteres_Bemerkung3],
|
|
[Server_Weiteres_Bemerkung4],
|
|
[Server_Weiteres_Bemerkung5],
|
|
[Server_ProviderNr],
|
|
[RZ_Betreiber_Standort]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServerInventarNr,
|
|
@iParentID,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iServer_UmgebungNr,
|
|
@iServer_KategorieNr,
|
|
@iServer_OSNr,
|
|
@iServer_OSLevelNr,
|
|
@sBemerkung_OS,
|
|
@iServer_Backup_LoesungNr,
|
|
@iServer_Backup_RetentionNr,
|
|
@sServer_Backup_Bemerkung,
|
|
@iServer_DBNr,
|
|
@sServer_DB_Bemerkung,
|
|
@iServer_DB_Backup_LoesungNr,
|
|
@iServer_DB_Backup_RetentionNr,
|
|
@sServer_DB_Backup_Bemerkung,
|
|
@iServer_StandortNr,
|
|
@sServer_Stanmdort_Bemerkung,
|
|
@iServer_Weiteres_TypNr1,
|
|
@iServer_Weiteres_TypNr2,
|
|
@iServer_Weiteres_TypNr3,
|
|
@iServer_Weiteres_TypNr4,
|
|
@iServer_Weiteres_TypNr5,
|
|
@iServer_Weiteres_Backup_LoesungNr1,
|
|
@iServer_Weiteres_Backup_LoesungNr2,
|
|
@iServer_Weiteres_Backup_LoesungNr3,
|
|
@iServer_Weiteres_Backup_LoesungNr4,
|
|
@iServer_Weiteres_Backup_LoesungNr5,
|
|
@iServer_Weiteres_RetentionNr1,
|
|
@iServer_Weiteres_RetentionNr2,
|
|
@iServer_Weiteres_RetentionNr3,
|
|
@iServer_Weiteres_RetentionNr4,
|
|
@iServer_Weiteres_RetentionNr5,
|
|
@sServer_Weiteres_Bemerkung1,
|
|
@sServer_Weiteres_Bemerkung2,
|
|
@sServer_Weiteres_Bemerkung3,
|
|
@sServer_Weiteres_Bemerkung4,
|
|
@sServer_Weiteres_Bemerkung5,
|
|
@iServer_ProviderNr,
|
|
@sRZ_Betreiber_Standort
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Inventar_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Inventar'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Inventar_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ServerInventarNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Server_UmgebungNr],
|
|
[Server_KategorieNr],
|
|
[Server_OSNr],
|
|
[Server_OSLevelNr],
|
|
[Bemerkung_OS],
|
|
[Server_Backup_LoesungNr],
|
|
[Server_Backup_RetentionNr],
|
|
[Server_Backup_Bemerkung],
|
|
[Server_DBNr],
|
|
[Server_DB_Bemerkung],
|
|
[Server_DB_Backup_LoesungNr],
|
|
[Server_DB_Backup_RetentionNr],
|
|
[Server_DB_Backup_Bemerkung],
|
|
[Server_StandortNr],
|
|
[Server_Stanmdort_Bemerkung],
|
|
[Server_Weiteres_TypNr1],
|
|
[Server_Weiteres_TypNr2],
|
|
[Server_Weiteres_TypNr3],
|
|
[Server_Weiteres_TypNr4],
|
|
[Server_Weiteres_TypNr5],
|
|
[Server_Weiteres_Backup_LoesungNr1],
|
|
[Server_Weiteres_Backup_LoesungNr2],
|
|
[Server_Weiteres_Backup_LoesungNr3],
|
|
[Server_Weiteres_Backup_LoesungNr4],
|
|
[Server_Weiteres_Backup_LoesungNr5],
|
|
[Server_Weiteres_RetentionNr1],
|
|
[Server_Weiteres_RetentionNr2],
|
|
[Server_Weiteres_RetentionNr3],
|
|
[Server_Weiteres_RetentionNr4],
|
|
[Server_Weiteres_RetentionNr5],
|
|
[Server_Weiteres_Bemerkung1],
|
|
[Server_Weiteres_Bemerkung2],
|
|
[Server_Weiteres_Bemerkung3],
|
|
[Server_Weiteres_Bemerkung4],
|
|
[Server_Weiteres_Bemerkung5],
|
|
[Server_ProviderNr],
|
|
[RZ_Betreiber_Standort]
|
|
FROM [dbo].[Server_Inventar]
|
|
ORDER BY
|
|
[ServerInventarNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Inventar_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Inventar'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServerInventarNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Inventar_SelectOne]
|
|
@iServerInventarNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ServerInventarNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Server_UmgebungNr],
|
|
[Server_KategorieNr],
|
|
[Server_OSNr],
|
|
[Server_OSLevelNr],
|
|
[Bemerkung_OS],
|
|
[Server_Backup_LoesungNr],
|
|
[Server_Backup_RetentionNr],
|
|
[Server_Backup_Bemerkung],
|
|
[Server_DBNr],
|
|
[Server_DB_Bemerkung],
|
|
[Server_DB_Backup_LoesungNr],
|
|
[Server_DB_Backup_RetentionNr],
|
|
[Server_DB_Backup_Bemerkung],
|
|
[Server_StandortNr],
|
|
[Server_Stanmdort_Bemerkung],
|
|
[Server_Weiteres_TypNr1],
|
|
[Server_Weiteres_TypNr2],
|
|
[Server_Weiteres_TypNr3],
|
|
[Server_Weiteres_TypNr4],
|
|
[Server_Weiteres_TypNr5],
|
|
[Server_Weiteres_Backup_LoesungNr1],
|
|
[Server_Weiteres_Backup_LoesungNr2],
|
|
[Server_Weiteres_Backup_LoesungNr3],
|
|
[Server_Weiteres_Backup_LoesungNr4],
|
|
[Server_Weiteres_Backup_LoesungNr5],
|
|
[Server_Weiteres_RetentionNr1],
|
|
[Server_Weiteres_RetentionNr2],
|
|
[Server_Weiteres_RetentionNr3],
|
|
[Server_Weiteres_RetentionNr4],
|
|
[Server_Weiteres_RetentionNr5],
|
|
[Server_Weiteres_Bemerkung1],
|
|
[Server_Weiteres_Bemerkung2],
|
|
[Server_Weiteres_Bemerkung3],
|
|
[Server_Weiteres_Bemerkung4],
|
|
[Server_Weiteres_Bemerkung5],
|
|
[Server_ProviderNr],
|
|
[RZ_Betreiber_Standort]
|
|
FROM [dbo].[Server_Inventar]
|
|
WHERE
|
|
[ServerInventarNr] = @iServerInventarNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Inventar_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Inventar'
|
|
-- Gets: @iServerInventarNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iServer_UmgebungNr int
|
|
-- Gets: @iServer_KategorieNr int
|
|
-- Gets: @iServer_OSNr int
|
|
-- Gets: @iServer_OSLevelNr int
|
|
-- Gets: @sBemerkung_OS varchar(1024)
|
|
-- Gets: @iServer_Backup_LoesungNr int
|
|
-- Gets: @iServer_Backup_RetentionNr int
|
|
-- Gets: @sServer_Backup_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_DBNr int
|
|
-- Gets: @sServer_DB_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_DB_Backup_LoesungNr int
|
|
-- Gets: @iServer_DB_Backup_RetentionNr int
|
|
-- Gets: @sServer_DB_Backup_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_StandortNr int
|
|
-- Gets: @sServer_Stanmdort_Bemerkung varchar(1024)
|
|
-- Gets: @iServer_Weiteres_TypNr1 int
|
|
-- Gets: @iServer_Weiteres_TypNr2 int
|
|
-- Gets: @iServer_Weiteres_TypNr3 int
|
|
-- Gets: @iServer_Weiteres_TypNr4 int
|
|
-- Gets: @iServer_Weiteres_TypNr5 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr1 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr2 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr3 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr4 int
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr5 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr1 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr2 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr3 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr4 int
|
|
-- Gets: @iServer_Weiteres_RetentionNr5 int
|
|
-- Gets: @sServer_Weiteres_Bemerkung1 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung2 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung3 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung4 varchar(1024)
|
|
-- Gets: @sServer_Weiteres_Bemerkung5 varchar(1024)
|
|
-- Gets: @iServer_ProviderNr int
|
|
-- Gets: @sRZ_Betreiber_Standort varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Inventar_Update]
|
|
@iServerInventarNr int,
|
|
@iParentID int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iServer_UmgebungNr int,
|
|
@iServer_KategorieNr int,
|
|
@iServer_OSNr int,
|
|
@iServer_OSLevelNr int,
|
|
@sBemerkung_OS varchar(1024),
|
|
@iServer_Backup_LoesungNr int,
|
|
@iServer_Backup_RetentionNr int,
|
|
@sServer_Backup_Bemerkung varchar(1024),
|
|
@iServer_DBNr int,
|
|
@sServer_DB_Bemerkung varchar(1024),
|
|
@iServer_DB_Backup_LoesungNr int,
|
|
@iServer_DB_Backup_RetentionNr int,
|
|
@sServer_DB_Backup_Bemerkung varchar(1024),
|
|
@iServer_StandortNr int,
|
|
@sServer_Stanmdort_Bemerkung varchar(1024),
|
|
@iServer_Weiteres_TypNr1 int,
|
|
@iServer_Weiteres_TypNr2 int,
|
|
@iServer_Weiteres_TypNr3 int,
|
|
@iServer_Weiteres_TypNr4 int,
|
|
@iServer_Weiteres_TypNr5 int,
|
|
@iServer_Weiteres_Backup_LoesungNr1 int,
|
|
@iServer_Weiteres_Backup_LoesungNr2 int,
|
|
@iServer_Weiteres_Backup_LoesungNr3 int,
|
|
@iServer_Weiteres_Backup_LoesungNr4 int,
|
|
@iServer_Weiteres_Backup_LoesungNr5 int,
|
|
@iServer_Weiteres_RetentionNr1 int,
|
|
@iServer_Weiteres_RetentionNr2 int,
|
|
@iServer_Weiteres_RetentionNr3 int,
|
|
@iServer_Weiteres_RetentionNr4 int,
|
|
@iServer_Weiteres_RetentionNr5 int,
|
|
@sServer_Weiteres_Bemerkung1 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung2 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung3 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung4 varchar(1024),
|
|
@sServer_Weiteres_Bemerkung5 varchar(1024),
|
|
@iServer_ProviderNr int,
|
|
@sRZ_Betreiber_Standort varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Server_Inventar]
|
|
SET
|
|
[ParentID] = @iParentID,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Server_UmgebungNr] = @iServer_UmgebungNr,
|
|
[Server_KategorieNr] = @iServer_KategorieNr,
|
|
[Server_OSNr] = @iServer_OSNr,
|
|
[Server_OSLevelNr] = @iServer_OSLevelNr,
|
|
[Bemerkung_OS] = @sBemerkung_OS,
|
|
[Server_Backup_LoesungNr] = @iServer_Backup_LoesungNr,
|
|
[Server_Backup_RetentionNr] = @iServer_Backup_RetentionNr,
|
|
[Server_Backup_Bemerkung] = @sServer_Backup_Bemerkung,
|
|
[Server_DBNr] = @iServer_DBNr,
|
|
[Server_DB_Bemerkung] = @sServer_DB_Bemerkung,
|
|
[Server_DB_Backup_LoesungNr] = @iServer_DB_Backup_LoesungNr,
|
|
[Server_DB_Backup_RetentionNr] = @iServer_DB_Backup_RetentionNr,
|
|
[Server_DB_Backup_Bemerkung] = @sServer_DB_Backup_Bemerkung,
|
|
[Server_StandortNr] = @iServer_StandortNr,
|
|
[Server_Stanmdort_Bemerkung] = @sServer_Stanmdort_Bemerkung,
|
|
[Server_Weiteres_TypNr1] = @iServer_Weiteres_TypNr1,
|
|
[Server_Weiteres_TypNr2] = @iServer_Weiteres_TypNr2,
|
|
[Server_Weiteres_TypNr3] = @iServer_Weiteres_TypNr3,
|
|
[Server_Weiteres_TypNr4] = @iServer_Weiteres_TypNr4,
|
|
[Server_Weiteres_TypNr5] = @iServer_Weiteres_TypNr5,
|
|
[Server_Weiteres_Backup_LoesungNr1] = @iServer_Weiteres_Backup_LoesungNr1,
|
|
[Server_Weiteres_Backup_LoesungNr2] = @iServer_Weiteres_Backup_LoesungNr2,
|
|
[Server_Weiteres_Backup_LoesungNr3] = @iServer_Weiteres_Backup_LoesungNr3,
|
|
[Server_Weiteres_Backup_LoesungNr4] = @iServer_Weiteres_Backup_LoesungNr4,
|
|
[Server_Weiteres_Backup_LoesungNr5] = @iServer_Weiteres_Backup_LoesungNr5,
|
|
[Server_Weiteres_RetentionNr1] = @iServer_Weiteres_RetentionNr1,
|
|
[Server_Weiteres_RetentionNr2] = @iServer_Weiteres_RetentionNr2,
|
|
[Server_Weiteres_RetentionNr3] = @iServer_Weiteres_RetentionNr3,
|
|
[Server_Weiteres_RetentionNr4] = @iServer_Weiteres_RetentionNr4,
|
|
[Server_Weiteres_RetentionNr5] = @iServer_Weiteres_RetentionNr5,
|
|
[Server_Weiteres_Bemerkung1] = @sServer_Weiteres_Bemerkung1,
|
|
[Server_Weiteres_Bemerkung2] = @sServer_Weiteres_Bemerkung2,
|
|
[Server_Weiteres_Bemerkung3] = @sServer_Weiteres_Bemerkung3,
|
|
[Server_Weiteres_Bemerkung4] = @sServer_Weiteres_Bemerkung4,
|
|
[Server_Weiteres_Bemerkung5] = @sServer_Weiteres_Bemerkung5,
|
|
[Server_ProviderNr] = @iServer_ProviderNr,
|
|
[RZ_Betreiber_Standort] = @sRZ_Betreiber_Standort
|
|
WHERE
|
|
[ServerInventarNr] = @iServerInventarNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Kategorie_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Kategorie'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_KategorieNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Kategorie_Delete]
|
|
@iServer_KategorieNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Kategorie]
|
|
WHERE
|
|
[Server_KategorieNr] = @iServer_KategorieNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Kategorie_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Kategorie'
|
|
-- Gets: @iServer_KategorieNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Kategorie_Insert]
|
|
@iServer_KategorieNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Kategorie]
|
|
(
|
|
[Server_KategorieNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_KategorieNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Kategorie_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Kategorie'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Kategorie_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_KategorieNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Kategorie]
|
|
ORDER BY
|
|
[Server_KategorieNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Kategorie_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Kategorie'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_KategorieNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Kategorie_SelectOne]
|
|
@iServer_KategorieNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_KategorieNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Kategorie]
|
|
WHERE
|
|
[Server_KategorieNr] = @iServer_KategorieNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Kategorie_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Kategorie'
|
|
-- Gets: @iServer_KategorieNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Kategorie_Update]
|
|
@iServer_KategorieNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Kategorie]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_KategorieNr] = @iServer_KategorieNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OS_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_OS'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_OSNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OS_Delete]
|
|
@iServer_OSNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_OS]
|
|
WHERE
|
|
[Server_OSNr] = @iServer_OSNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OS_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_OS'
|
|
-- Gets: @iServer_OSNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OS_Insert]
|
|
@iServer_OSNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_OS]
|
|
(
|
|
[Server_OSNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_OSNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OS_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_OS'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OS_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_OSNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_OS]
|
|
ORDER BY
|
|
[Server_OSNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OS_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_OS'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_OSNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OS_SelectOne]
|
|
@iServer_OSNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_OSNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_OS]
|
|
WHERE
|
|
[Server_OSNr] = @iServer_OSNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OS_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_OS'
|
|
-- Gets: @iServer_OSNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OS_Update]
|
|
@iServer_OSNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_OS]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_OSNr] = @iServer_OSNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OSLevel_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_OSLevel'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_OSLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OSLevel_Delete]
|
|
@iServer_OSLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_OSLevel]
|
|
WHERE
|
|
[Server_OSLevelNr] = @iServer_OSLevelNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OSLevel_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_OSLevel'
|
|
-- Gets: @iServer_OSLevelNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OSLevel_Insert]
|
|
@iServer_OSLevelNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_OSLevel]
|
|
(
|
|
[Server_OSLevelNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_OSLevelNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OSLevel_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_OSLevel'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OSLevel_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_OSLevelNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_OSLevel]
|
|
ORDER BY
|
|
[Server_OSLevelNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OSLevel_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_OSLevel'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_OSLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OSLevel_SelectOne]
|
|
@iServer_OSLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_OSLevelNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_OSLevel]
|
|
WHERE
|
|
[Server_OSLevelNr] = @iServer_OSLevelNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_OSLevel_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_OSLevel'
|
|
-- Gets: @iServer_OSLevelNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_OSLevel_Update]
|
|
@iServer_OSLevelNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_OSLevel]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_OSLevelNr] = @iServer_OSLevelNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Provider_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Provider'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_ProviderNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Provider_Delete]
|
|
@iServer_ProviderNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Provider]
|
|
WHERE
|
|
[Server_ProviderNr] = @iServer_ProviderNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Provider_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Provider'
|
|
-- Gets: @iServer_ProviderNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Provider_Insert]
|
|
@iServer_ProviderNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Provider]
|
|
(
|
|
[Server_ProviderNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_ProviderNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Provider_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Provider'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Provider_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_ProviderNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Provider]
|
|
ORDER BY
|
|
[Server_ProviderNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Provider_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Provider'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_ProviderNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Provider_SelectOne]
|
|
@iServer_ProviderNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_ProviderNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Provider]
|
|
WHERE
|
|
[Server_ProviderNr] = @iServer_ProviderNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Provider_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Provider'
|
|
-- Gets: @iServer_ProviderNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Provider_Update]
|
|
@iServer_ProviderNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Provider]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_ProviderNr] = @iServer_ProviderNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Standort_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Standort'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_StandortNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Standort_Delete]
|
|
@iServer_StandortNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Standort]
|
|
WHERE
|
|
[Server_StandortNr] = @iServer_StandortNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Standort_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Standort'
|
|
-- Gets: @iServer_StandortNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Standort_Insert]
|
|
@iServer_StandortNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Standort]
|
|
(
|
|
[Server_StandortNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_StandortNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Standort_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Standort'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Standort_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_StandortNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Standort]
|
|
ORDER BY
|
|
[Server_StandortNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Standort_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Standort'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_StandortNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Standort_SelectOne]
|
|
@iServer_StandortNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_StandortNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Standort]
|
|
WHERE
|
|
[Server_StandortNr] = @iServer_StandortNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Standort_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Standort'
|
|
-- Gets: @iServer_StandortNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Standort_Update]
|
|
@iServer_StandortNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Standort]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_StandortNr] = @iServer_StandortNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Umgebung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Umgebung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_UmgebungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Umgebung_Delete]
|
|
@iServer_UmgebungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Umgebung]
|
|
WHERE
|
|
[Server_UmgebungNr] = @iServer_UmgebungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Umgebung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Umgebung'
|
|
-- Gets: @iServer_UmgebungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Umgebung_Insert]
|
|
@iServer_UmgebungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Umgebung]
|
|
(
|
|
[Server_UmgebungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_UmgebungNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Umgebung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Umgebung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Umgebung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_UmgebungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Umgebung]
|
|
ORDER BY
|
|
[Server_UmgebungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Umgebung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Umgebung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_UmgebungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Umgebung_SelectOne]
|
|
@iServer_UmgebungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_UmgebungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Umgebung]
|
|
WHERE
|
|
[Server_UmgebungNr] = @iServer_UmgebungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Umgebung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Umgebung'
|
|
-- Gets: @iServer_UmgebungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Umgebung_Update]
|
|
@iServer_UmgebungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Umgebung]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_UmgebungNr] = @iServer_UmgebungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Backup_Loesung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Weiteres_Backup_Loesung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Backup_Loesung_Delete]
|
|
@iServer_Weiteres_Backup_LoesungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Weiteres_Backup_Loesung]
|
|
WHERE
|
|
[Server_Weiteres_Backup_LoesungNr] = @iServer_Weiteres_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Backup_Loesung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Weiteres_Backup_Loesung'
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Backup_Loesung_Insert]
|
|
@iServer_Weiteres_Backup_LoesungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Weiteres_Backup_Loesung]
|
|
(
|
|
[Server_Weiteres_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_Weiteres_Backup_LoesungNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Backup_Loesung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Weiteres_Backup_Loesung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Backup_Loesung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_Weiteres_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Weiteres_Backup_Loesung]
|
|
ORDER BY
|
|
[Server_Weiteres_Backup_LoesungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Backup_Loesung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Weiteres_Backup_Loesung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Backup_Loesung_SelectOne]
|
|
@iServer_Weiteres_Backup_LoesungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_Weiteres_Backup_LoesungNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Weiteres_Backup_Loesung]
|
|
WHERE
|
|
[Server_Weiteres_Backup_LoesungNr] = @iServer_Weiteres_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Backup_Loesung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Weiteres_Backup_Loesung'
|
|
-- Gets: @iServer_Weiteres_Backup_LoesungNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Backup_Loesung_Update]
|
|
@iServer_Weiteres_Backup_LoesungNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Weiteres_Backup_Loesung]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_Weiteres_Backup_LoesungNr] = @iServer_Weiteres_Backup_LoesungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Retention_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Weiteres_Retention'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_Weiteres_RetentionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Retention_Delete]
|
|
@iServer_Weiteres_RetentionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Weiteres_Retention]
|
|
WHERE
|
|
[Server_Weiteres_RetentionNr] = @iServer_Weiteres_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Retention_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Weiteres_Retention'
|
|
-- Gets: @iServer_Weiteres_RetentionNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Retention_Insert]
|
|
@iServer_Weiteres_RetentionNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Weiteres_Retention]
|
|
(
|
|
[Server_Weiteres_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_Weiteres_RetentionNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Retention_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Weiteres_Retention'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Retention_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_Weiteres_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Weiteres_Retention]
|
|
ORDER BY
|
|
[Server_Weiteres_RetentionNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Retention_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Weiteres_Retention'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_Weiteres_RetentionNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Retention_SelectOne]
|
|
@iServer_Weiteres_RetentionNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_Weiteres_RetentionNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Weiteres_Retention]
|
|
WHERE
|
|
[Server_Weiteres_RetentionNr] = @iServer_Weiteres_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Retention_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Weiteres_Retention'
|
|
-- Gets: @iServer_Weiteres_RetentionNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Retention_Update]
|
|
@iServer_Weiteres_RetentionNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Weiteres_Retention]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_Weiteres_RetentionNr] = @iServer_Weiteres_RetentionNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Typ_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Server_Weiteres_Typ'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServer_Weiteres_TypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Typ_Delete]
|
|
@iServer_Weiteres_TypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Server_Weiteres_Typ]
|
|
WHERE
|
|
[Server_Weiteres_TypNr] = @iServer_Weiteres_TypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Typ_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Server_Weiteres_Typ'
|
|
-- Gets: @iServer_Weiteres_TypNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Typ_Insert]
|
|
@iServer_Weiteres_TypNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Weiteres_Typ]
|
|
(
|
|
[Server_Weiteres_TypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServer_Weiteres_TypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Typ_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Server_Weiteres_Typ'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Typ_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Server_Weiteres_TypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Weiteres_Typ]
|
|
ORDER BY
|
|
[Server_Weiteres_TypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Typ_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Server_Weiteres_Typ'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServer_Weiteres_TypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Typ_SelectOne]
|
|
@iServer_Weiteres_TypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Server_Weiteres_TypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Server_Weiteres_Typ]
|
|
WHERE
|
|
[Server_Weiteres_TypNr] = @iServer_Weiteres_TypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Server_Weiteres_Typ_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Server_Weiteres_Typ'
|
|
-- Gets: @iServer_Weiteres_TypNr int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Server_Weiteres_Typ_Update]
|
|
@iServer_Weiteres_TypNr int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung 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].[Server_Weiteres_Typ]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[Server_Weiteres_TypNr] = @iServer_Weiteres_TypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ServiceKatalog'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServiceKatalogNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_Delete]
|
|
@iServiceKatalogNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ServiceKatalog]
|
|
WHERE
|
|
[ServiceKatalogNr] = @iServiceKatalogNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ServiceKatalog'
|
|
-- Gets: @iServiceKatalogNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @sBezeichnung_intern varchar(50)
|
|
-- Gets: @sBezeichnung_extern varchar(50)
|
|
-- Gets: @bextern bit
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_Insert]
|
|
@iServiceKatalogNr int,
|
|
@iParentID int,
|
|
@sBezeichnung_intern varchar(50),
|
|
@sBezeichnung_extern varchar(50),
|
|
@bextern bit,
|
|
@sBemerkung varchar(255),
|
|
@iSecurityLevelNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ServiceKatalog]
|
|
(
|
|
[ServiceKatalogNr],
|
|
[ParentID],
|
|
[Bezeichnung_intern],
|
|
[Bezeichnung_extern],
|
|
[extern],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServiceKatalogNr,
|
|
@iParentID,
|
|
@sBezeichnung_intern,
|
|
@sBezeichnung_extern,
|
|
@bextern,
|
|
@sBemerkung,
|
|
@iSecurityLevelNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ServiceKatalog'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ServiceKatalogNr],
|
|
[ParentID],
|
|
[Bezeichnung_intern],
|
|
[Bezeichnung_extern],
|
|
[extern],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[ServiceKatalog]
|
|
ORDER BY
|
|
[ServiceKatalogNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ServiceKatalog'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServiceKatalogNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SelectOne]
|
|
@iServiceKatalogNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ServiceKatalogNr],
|
|
[ParentID],
|
|
[Bezeichnung_intern],
|
|
[Bezeichnung_extern],
|
|
[extern],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[ServiceKatalog]
|
|
WHERE
|
|
[ServiceKatalogNr] = @iServiceKatalogNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SLAKatalog_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'ServiceKatalog_SLAKatalog'
|
|
-- using the Primary Key.
|
|
-- Gets: @iServiceKatalog_SLAKatalognr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SLAKatalog_Delete]
|
|
@iServiceKatalog_SLAKatalognr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[ServiceKatalog_SLAKatalog]
|
|
WHERE
|
|
[ServiceKatalog_SLAKatalognr] = @iServiceKatalog_SLAKatalognr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SLAKatalog_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'ServiceKatalog_SLAKatalog'
|
|
-- Gets: @iServiceKatalog_SLAKatalognr int
|
|
-- Gets: @iServiceKatalognr int
|
|
-- Gets: @iSLAKatalogNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SLAKatalog_Insert]
|
|
@iServiceKatalog_SLAKatalognr int,
|
|
@iServiceKatalognr int,
|
|
@iSLAKatalogNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[ServiceKatalog_SLAKatalog]
|
|
(
|
|
[ServiceKatalog_SLAKatalognr],
|
|
[ServiceKatalognr],
|
|
[SLAKatalogNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iServiceKatalog_SLAKatalognr,
|
|
@iServiceKatalognr,
|
|
@iSLAKatalogNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SLAKatalog_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'ServiceKatalog_SLAKatalog'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SLAKatalog_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ServiceKatalog_SLAKatalognr],
|
|
[ServiceKatalognr],
|
|
[SLAKatalogNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[ServiceKatalog_SLAKatalog]
|
|
ORDER BY
|
|
[ServiceKatalog_SLAKatalognr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SLAKatalog_SelectAll_Bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'funktionsgruppe_rolle'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SLAKatalog_SelectAll_Bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
SELECT dbo.ServiceKatalog_SLAKatalog.ServiceKatalog_SLAKatalognr, dbo.ServiceKatalog_SLAKatalog.ServiceKatalognr, dbo.ServiceKatalog_SLAKatalog.SLAKatalogNr,
|
|
dbo.ServiceKatalog_SLAKatalog.Aktiv, dbo.ServiceKatalog_SLAKatalog.Erstellt_am, dbo.ServiceKatalog_SLAKatalog.Mutiert_am,
|
|
dbo.ServiceKatalog_SLAKatalog.Mutierer, dbo.ServiceKatalog_SLAKatalog.Mandantnr,
|
|
dbo.SLATyp.Bezeichnung AS SLATyp, dbo.SLASubTyp.Bezeichnung AS SLASubTyp, dbo.SLAKatalog.Zeit, dbo.Zeiteinheittyp.Bezeichnung AS Zeiteinheit
|
|
FROM dbo.SLAKatalog INNER JOIN
|
|
dbo.SLA ON dbo.SLAKatalog.SLANr = dbo.SLA.SLANr INNER JOIN
|
|
dbo.SLATyp ON dbo.SLA.SLATypNr = dbo.SLATyp.SLATypNr INNER JOIN
|
|
dbo.SLASubTyp ON dbo.SLA.SLASubTypNr = dbo.SLASubTyp.SLASubTypNr INNER JOIN
|
|
dbo.Zeiteinheittyp ON dbo.SLAKatalog.Zeiteinheittypnr = dbo.Zeiteinheittyp.Zeiteinheittypnr INNER JOIN
|
|
dbo.ServiceKatalog_SLAKatalog ON dbo.SLAKatalog.SLAKatalogNr = dbo.ServiceKatalog_SLAKatalog.SLAKatalogNr
|
|
WHERE (dbo.servicekatalog_slakatalog.servicekatalognr = @keyvalue) and dbo.SLAKatalog.SecurityLevel<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SLAKatalog_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'ServiceKatalog_SLAKatalog'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iServiceKatalog_SLAKatalognr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SLAKatalog_SelectOne]
|
|
@iServiceKatalog_SLAKatalognr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ServiceKatalog_SLAKatalognr],
|
|
[ServiceKatalognr],
|
|
[SLAKatalogNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[ServiceKatalog_SLAKatalog]
|
|
WHERE
|
|
[ServiceKatalog_SLAKatalognr] = @iServiceKatalog_SLAKatalognr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_SLAKatalog_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ServiceKatalog_SLAKatalog'
|
|
-- Gets: @iServiceKatalog_SLAKatalognr int
|
|
-- Gets: @iServiceKatalognr int
|
|
-- Gets: @iSLAKatalogNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_SLAKatalog_Update]
|
|
@iServiceKatalog_SLAKatalognr int,
|
|
@iServiceKatalognr int,
|
|
@iSLAKatalogNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ServiceKatalog_SLAKatalog]
|
|
SET
|
|
[ServiceKatalognr] = @iServiceKatalognr,
|
|
[SLAKatalogNr] = @iSLAKatalogNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[ServiceKatalog_SLAKatalognr] = @iServiceKatalog_SLAKatalognr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_ServiceKatalog_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'ServiceKatalog'
|
|
-- Gets: @iServiceKatalogNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @sBezeichnung_intern varchar(50)
|
|
-- Gets: @sBezeichnung_extern varchar(50)
|
|
-- Gets: @bextern bit
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_ServiceKatalog_Update]
|
|
@iServiceKatalogNr int,
|
|
@iParentID int,
|
|
@sBezeichnung_intern varchar(50),
|
|
@sBezeichnung_extern varchar(50),
|
|
@bextern bit,
|
|
@sBemerkung varchar(255),
|
|
@iSecurityLevelNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[ServiceKatalog]
|
|
SET
|
|
[ParentID] = @iParentID,
|
|
[Bezeichnung_intern] = @sBezeichnung_intern,
|
|
[Bezeichnung_extern] = @sBezeichnung_extern,
|
|
[extern] = @bextern,
|
|
[Bemerkung] = @sBemerkung,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[ServiceKatalogNr] = @iServiceKatalogNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLA_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'SLA'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSLANr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLA_Delete]
|
|
@iSLANr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[SLA]
|
|
WHERE
|
|
[SLANr] = @iSLANr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLA_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SLA'
|
|
-- Gets: @iSLANr int
|
|
-- Gets: @iSLATypNr int
|
|
-- Gets: @iSLASubTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLA_Insert]
|
|
@iSLANr int,
|
|
@iSLATypNr int,
|
|
@iSLASubTypNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[SLA]
|
|
(
|
|
[SLANr],
|
|
[SLATypNr],
|
|
[SLASubTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSLANr,
|
|
@iSLATypNr,
|
|
@iSLASubTypNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLA_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SLA'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLA_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SLANr],
|
|
[SLATypNr],
|
|
[SLASubTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[SLA]
|
|
ORDER BY
|
|
[SLANr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_sla_selectall_active] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'rolle_sysadminfunktion'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_sla_selectall_active]
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
SELECT dbo.SLA.SLANr, dbo.SLATyp.Bezeichnung + ' | ' + dbo.SLASubTyp.Bezeichnung AS SLA
|
|
FROM dbo.SLA INNER JOIN
|
|
dbo.SLATyp ON dbo.SLA.SLATypNr = dbo.SLATyp.SLATypNr INNER JOIN
|
|
dbo.SLASubTyp ON dbo.SLA.SLASubTypNr = dbo.SLASubTyp.SLASubTypNr
|
|
where sla.aktiv=1
|
|
ORDER BY dbo.slatyp.bezeichnung, slasubtyp.bezeichnung
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLA_SelectAll_BottomTable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'rolle_sysadminfunktion'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_SLA_SelectAll_BottomTable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int
|
|
AS
|
|
SET NOCOUNT ON
|
|
|
|
if @fokus = 1 begin
|
|
SELECT dbo.SLA.SLANr, dbo.SLA.SLATypNr, dbo.SLA.SLASubTypNr, dbo.SLATyp.Bezeichnung AS SLATyp, dbo.SLASubTyp.Bezeichnung AS SLASubTyp, dbo.SLA.Aktiv,
|
|
dbo.SLA.Erstellt_am, dbo.SLA.Mutiert_am, dbo.SLA.Mutierer, dbo.SLA.MandantNr
|
|
FROM dbo.SLA INNER JOIN
|
|
dbo.SLATyp ON dbo.SLA.SLATypNr = dbo.SLATyp.SLATypNr INNER JOIN
|
|
dbo.SLASubTyp ON dbo.SLA.SLASubTypNr = dbo.SLASubTyp.SLASubTypNr
|
|
where slatyp.slatypnr=@keyvalue
|
|
ORDER BY dbo.slatyp.bezeichnung, slasubtyp.bezeichnung
|
|
end else begin
|
|
SELECT dbo.SLA.SLANr, dbo.SLA.SLATypNr, dbo.SLA.SLASubTypNr, dbo.SLATyp.Bezeichnung AS SLATyp, dbo.SLASubTyp.Bezeichnung AS SLASubTyp, dbo.SLA.Aktiv,
|
|
dbo.SLA.Erstellt_am, dbo.SLA.Mutiert_am, dbo.SLA.Mutierer, dbo.SLA.MandantNr
|
|
FROM dbo.SLA INNER JOIN
|
|
dbo.SLATyp ON dbo.SLA.SLATypNr = dbo.SLATyp.SLATypNr INNER JOIN
|
|
dbo.SLASubTyp ON dbo.SLA.SLASubTypNr = dbo.SLASubTyp.SLASubTypNr
|
|
where slasubtyp.slasubtypnr=@keyvalue
|
|
ORDER BY dbo.slatyp.bezeichnung, slasubtyp.bezeichnung
|
|
end
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLA_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'SLA'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSLANr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLA_SelectOne]
|
|
@iSLANr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SLANr],
|
|
[SLATypNr],
|
|
[SLASubTypNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr]
|
|
FROM [dbo].[SLA]
|
|
WHERE
|
|
[SLANr] = @iSLANr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLA_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'SLA'
|
|
-- Gets: @iSLANr int
|
|
-- Gets: @iSLATypNr int
|
|
-- Gets: @iSLASubTypNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLA_Update]
|
|
@iSLANr int,
|
|
@iSLATypNr int,
|
|
@iSLASubTypNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[SLA]
|
|
SET
|
|
[SLATypNr] = @iSLATypNr,
|
|
[SLASubTypNr] = @iSLASubTypNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr
|
|
WHERE
|
|
[SLANr] = @iSLANr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLAKatalog_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'SLAKatalog'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSLAKatalogNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLAKatalog_Delete]
|
|
@iSLAKatalogNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[SLAKatalog]
|
|
WHERE
|
|
[SLAKatalogNr] = @iSLAKatalogNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLAKatalog_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SLAKatalog'
|
|
-- Gets: @iSLAKatalogNr int
|
|
-- Gets: @iSLANr int
|
|
-- Gets: @fZeit float(53)
|
|
-- Gets: @iZeiteinheittypnr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevel int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLAKatalog_Insert]
|
|
@iSLAKatalogNr int,
|
|
@iSLANr int,
|
|
@fZeit float(53),
|
|
@iZeiteinheittypnr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevel int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[SLAKatalog]
|
|
(
|
|
[SLAKatalogNr],
|
|
[SLANr],
|
|
[Zeit],
|
|
[Zeiteinheittypnr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevel]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSLAKatalogNr,
|
|
@iSLANr,
|
|
@fZeit,
|
|
@iZeiteinheittypnr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@iSecurityLevel
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLAKatalog_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SLAKatalog'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLAKatalog_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SLAKatalogNr],
|
|
[SLANr],
|
|
[Zeit],
|
|
[Zeiteinheittypnr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevel]
|
|
FROM [dbo].[SLAKatalog]
|
|
ORDER BY
|
|
[SLAKatalogNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLAKatalog_SelectAll_Level] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SLAKatalog'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLAKatalog_SelectAll_Level]
|
|
@mitarbeiternr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SLAKatalogNr],
|
|
[SLANr],
|
|
[Zeit],
|
|
[Zeiteinheittypnr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevel]
|
|
FROM [dbo].[SLAKatalog]
|
|
where securitylevel>=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
ORDER BY
|
|
[SLAKatalogNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLAKatalog_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'SLAKatalog'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSLAKatalogNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLAKatalog_SelectOne]
|
|
@iSLAKatalogNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SLAKatalogNr],
|
|
[SLANr],
|
|
[Zeit],
|
|
[Zeiteinheittypnr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevel]
|
|
FROM [dbo].[SLAKatalog]
|
|
WHERE
|
|
[SLAKatalogNr] = @iSLAKatalogNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLAKatalog_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'SLAKatalog'
|
|
-- Gets: @iSLAKatalogNr int
|
|
-- Gets: @iSLANr int
|
|
-- Gets: @fZeit float(53)
|
|
-- Gets: @iZeiteinheittypnr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevel int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLAKatalog_Update]
|
|
@iSLAKatalogNr int,
|
|
@iSLANr int,
|
|
@fZeit float(53),
|
|
@iZeiteinheittypnr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevel int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[SLAKatalog]
|
|
SET
|
|
[SLANr] = @iSLANr,
|
|
[Zeit] = @fZeit,
|
|
[Zeiteinheittypnr] = @iZeiteinheittypnr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[SecurityLevel] = @iSecurityLevel
|
|
WHERE
|
|
[SLAKatalogNr] = @iSLAKatalogNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLASubTyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'SLASubTyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSLASubTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLASubTyp_Delete]
|
|
@iSLASubTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[SLASubTyp]
|
|
WHERE
|
|
[SLASubTypNr] = @iSLASubTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLASubTyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SLASubTyp'
|
|
-- Gets: @iSLASubTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLASubTyp_Insert]
|
|
@iSLASubTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[SLASubTyp]
|
|
(
|
|
[SLASubTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSLASubTypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLASubTyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SLASubTyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLASubTyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SLASubTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SLASubTyp]
|
|
ORDER BY
|
|
[SLASubTypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLASubTyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'SLASubTyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSLASubTypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLASubTyp_SelectOne]
|
|
@iSLASubTypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SLASubTypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SLASubTyp]
|
|
WHERE
|
|
[SLASubTypNr] = @iSLASubTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLASubTyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'SLASubTyp'
|
|
-- Gets: @iSLASubTypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLASubTyp_Update]
|
|
@iSLASubTypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[SLASubTyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[SLASubTypNr] = @iSLASubTypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLATyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'SLATyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iSLATypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLATyp_Delete]
|
|
@iSLATypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[SLATyp]
|
|
WHERE
|
|
[SLATypNr] = @iSLATypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLATyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'SLATyp'
|
|
-- Gets: @iSLATypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLATyp_Insert]
|
|
@iSLATypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[SLATyp]
|
|
(
|
|
[SLATypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iSLATypNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLATyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SLATyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLATyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SLATypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SLATyp]
|
|
ORDER BY
|
|
[SLATypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLATyp_SelectAll_Aktive] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'SLATyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLATyp_SelectAll_Aktive]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[SLATypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SLATyp]
|
|
where aktiv=1
|
|
ORDER BY
|
|
[SLATypNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLATyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'SLATyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iSLATypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLATyp_SelectOne]
|
|
@iSLATypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[SLATypNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[SLATyp]
|
|
WHERE
|
|
[SLATypNr] = @iSLATypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_SLATyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'SLATyp'
|
|
-- Gets: @iSLATypNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_SLATyp_Update]
|
|
@iSLATypNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[SLATyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[SLATypNr] = @iSLATypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_spalten_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'spalten'
|
|
-- using the Primary Key.
|
|
-- Gets: @ieintragnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_spalten_Delete]
|
|
@ieintragnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[spalten]
|
|
WHERE
|
|
[eintragnr] = @ieintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_spalten_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'spalten'
|
|
-- Gets: @ieintragnr int
|
|
-- Gets: @stabelle varchar(255)
|
|
-- Gets: @stabellenspalte varchar(255)
|
|
-- Gets: @sspalte varchar(255)
|
|
-- Gets: @bReadonly bit
|
|
-- Gets: @balsHacken bit
|
|
-- Gets: @iBreite int
|
|
-- Gets: @iReihenfolge int
|
|
-- Gets: @stiptext varchar(255)
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @sNumberFormat varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_spalten_Insert]
|
|
@ieintragnr int,
|
|
@stabelle varchar(255),
|
|
@stabellenspalte varchar(255),
|
|
@sspalte varchar(255),
|
|
@bReadonly bit,
|
|
@balsHacken bit,
|
|
@iBreite int,
|
|
@iReihenfolge int,
|
|
@stiptext varchar(255),
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@imandantnr int,
|
|
@sNumberFormat varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[spalten]
|
|
(
|
|
[eintragnr],
|
|
[tabelle],
|
|
[tabellenspalte],
|
|
[spalte],
|
|
[Readonly],
|
|
[alsHacken],
|
|
[Breite],
|
|
[Reihenfolge],
|
|
[tiptext],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr],
|
|
[NumberFormat]
|
|
)
|
|
VALUES
|
|
(
|
|
@ieintragnr,
|
|
@stabelle,
|
|
@stabellenspalte,
|
|
@sspalte,
|
|
@bReadonly,
|
|
@balsHacken,
|
|
@iBreite,
|
|
@iReihenfolge,
|
|
@stiptext,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@imandantnr,
|
|
@sNumberFormat
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_spalten_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'spalten'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_spalten_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[eintragnr],
|
|
[tabelle],
|
|
[tabellenspalte],
|
|
[spalte],
|
|
[Readonly],
|
|
[alsHacken],
|
|
[Breite],
|
|
[Reihenfolge],
|
|
[tiptext],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr],
|
|
[NumberFormat]
|
|
FROM [dbo].[spalten]
|
|
ORDER BY
|
|
[eintragnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_spalten_SelectAll_Aktiv] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'spalten'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[pr_spalten_SelectAll_Aktiv]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[eintragnr],
|
|
tabelle,
|
|
tabellenspalte,
|
|
[spalte],
|
|
[Readonly],
|
|
[alsHacken],
|
|
[Breite],
|
|
[Reihenfolge],
|
|
[tiptext],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr],
|
|
[numberformat]
|
|
FROM [dbo].[spalten]
|
|
Where aktiv=1
|
|
ORDER BY
|
|
[eintragnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_spalten_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'spalten'
|
|
-- based on the Primary Key.
|
|
-- Gets: @ieintragnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_spalten_SelectOne]
|
|
@ieintragnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[eintragnr],
|
|
[tabelle],
|
|
[tabellenspalte],
|
|
[spalte],
|
|
[Readonly],
|
|
[alsHacken],
|
|
[Breite],
|
|
[Reihenfolge],
|
|
[tiptext],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[mandantnr],
|
|
[NumberFormat]
|
|
FROM [dbo].[spalten]
|
|
WHERE
|
|
[eintragnr] = @ieintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_spalten_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'spalten'
|
|
-- Gets: @ieintragnr int
|
|
-- Gets: @stabelle varchar(255)
|
|
-- Gets: @stabellenspalte varchar(255)
|
|
-- Gets: @sspalte varchar(255)
|
|
-- Gets: @bReadonly bit
|
|
-- Gets: @balsHacken bit
|
|
-- Gets: @iBreite int
|
|
-- Gets: @iReihenfolge int
|
|
-- Gets: @stiptext varchar(255)
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @sNumberFormat varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_spalten_Update]
|
|
@ieintragnr int,
|
|
@stabelle varchar(255),
|
|
@stabellenspalte varchar(255),
|
|
@sspalte varchar(255),
|
|
@bReadonly bit,
|
|
@balsHacken bit,
|
|
@iBreite int,
|
|
@iReihenfolge int,
|
|
@stiptext varchar(255),
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@imandantnr int,
|
|
@sNumberFormat varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[spalten]
|
|
SET
|
|
[tabelle] = @stabelle,
|
|
[tabellenspalte] = @stabellenspalte,
|
|
[spalte] = @sspalte,
|
|
[Readonly] = @bReadonly,
|
|
[alsHacken] = @balsHacken,
|
|
[Breite] = @iBreite,
|
|
[Reihenfolge] = @iReihenfolge,
|
|
[tiptext] = @stiptext,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[mandantnr] = @imandantnr,
|
|
[NumberFormat] = @sNumberFormat
|
|
WHERE
|
|
[eintragnr] = @ieintragnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_sysadminfunktion_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'sysadminfunktion'
|
|
-- using the Primary Key.
|
|
-- Gets: @isysadminfnktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_sysadminfunktion_Delete]
|
|
@isysadminfnktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[sysadminfunktion]
|
|
WHERE
|
|
[sysadminfnktnr] = @isysadminfnktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_sysadminfunktion_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'sysadminfunktion'
|
|
-- Gets: @isysadminfnktnr int
|
|
-- Gets: @sbezeichnung varchar(255)
|
|
-- Gets: @iParentID int
|
|
-- Gets: @iSort int
|
|
-- Gets: @iImageIndex int
|
|
-- Gets: @iImageIndexOpen int
|
|
-- Gets: @iftop int
|
|
-- Gets: @ifleft int
|
|
-- Gets: @ifwidth int
|
|
-- Gets: @ifheight int
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @isprache int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @sDomaintable varchar(255)
|
|
-- Gets: @sKeyFields varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_sysadminfunktion_Insert]
|
|
@isysadminfnktnr int,
|
|
@sbezeichnung varchar(255),
|
|
@iParentID int,
|
|
@iSort int,
|
|
@iImageIndex int,
|
|
@iImageIndexOpen int,
|
|
@iftop int,
|
|
@ifleft int,
|
|
@ifwidth int,
|
|
@ifheight int,
|
|
@sbeschreibung varchar(255),
|
|
@imandantnr int,
|
|
@isprache int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@sDomaintable varchar(255),
|
|
@sKeyFields varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[sysadminfunktion]
|
|
(
|
|
[sysadminfnktnr],
|
|
[bezeichnung],
|
|
[ParentID],
|
|
[Sort],
|
|
[ImageIndex],
|
|
[ImageIndexOpen],
|
|
[ftop],
|
|
[fleft],
|
|
[fwidth],
|
|
[fheight],
|
|
[beschreibung],
|
|
[mandantnr],
|
|
[sprache],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[Domaintable],
|
|
[KeyFields]
|
|
)
|
|
VALUES
|
|
(
|
|
@isysadminfnktnr,
|
|
@sbezeichnung,
|
|
@iParentID,
|
|
@iSort,
|
|
@iImageIndex,
|
|
@iImageIndexOpen,
|
|
@iftop,
|
|
@ifleft,
|
|
@ifwidth,
|
|
@ifheight,
|
|
@sbeschreibung,
|
|
@imandantnr,
|
|
@isprache,
|
|
@baktiv,
|
|
@daerstellt_am,
|
|
@damutiert_am,
|
|
@imutierer,
|
|
@sDomaintable,
|
|
@sKeyFields
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_sysadminfunktion_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'sysadminfunktion'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_sysadminfunktion_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[sysadminfnktnr],
|
|
[bezeichnung],
|
|
[ParentID],
|
|
[Sort],
|
|
[ImageIndex],
|
|
[ImageIndexOpen],
|
|
[ftop],
|
|
[fleft],
|
|
[fwidth],
|
|
[fheight],
|
|
[beschreibung],
|
|
[mandantnr],
|
|
[sprache],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[Domaintable],
|
|
[KeyFields]
|
|
FROM [dbo].[sysadminfunktion]
|
|
ORDER BY
|
|
[sysadminfnktnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_sysadminfunktion_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'sysadminfunktion'
|
|
-- based on the Primary Key.
|
|
-- Gets: @isysadminfnktnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_sysadminfunktion_SelectOne]
|
|
@isysadminfnktnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[sysadminfnktnr],
|
|
[bezeichnung],
|
|
[ParentID],
|
|
[Sort],
|
|
[ImageIndex],
|
|
[ImageIndexOpen],
|
|
[ftop],
|
|
[fleft],
|
|
[fwidth],
|
|
[fheight],
|
|
[beschreibung],
|
|
[mandantnr],
|
|
[sprache],
|
|
[aktiv],
|
|
[erstellt_am],
|
|
[mutiert_am],
|
|
[mutierer],
|
|
[Domaintable],
|
|
[KeyFields]
|
|
FROM [dbo].[sysadminfunktion]
|
|
WHERE
|
|
[sysadminfnktnr] = @isysadminfnktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_sysadminfunktion_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'sysadminfunktion'
|
|
-- Gets: @isysadminfnktnr int
|
|
-- Gets: @sbezeichnung varchar(255)
|
|
-- Gets: @iParentID int
|
|
-- Gets: @iSort int
|
|
-- Gets: @iImageIndex int
|
|
-- Gets: @iImageIndexOpen int
|
|
-- Gets: @iftop int
|
|
-- Gets: @ifleft int
|
|
-- Gets: @ifwidth int
|
|
-- Gets: @ifheight int
|
|
-- Gets: @sbeschreibung varchar(255)
|
|
-- Gets: @imandantnr int
|
|
-- Gets: @isprache int
|
|
-- Gets: @baktiv bit
|
|
-- Gets: @daerstellt_am datetime
|
|
-- Gets: @damutiert_am datetime
|
|
-- Gets: @imutierer int
|
|
-- Gets: @sDomaintable varchar(255)
|
|
-- Gets: @sKeyFields varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_sysadminfunktion_Update]
|
|
@isysadminfnktnr int,
|
|
@sbezeichnung varchar(255),
|
|
@iParentID int,
|
|
@iSort int,
|
|
@iImageIndex int,
|
|
@iImageIndexOpen int,
|
|
@iftop int,
|
|
@ifleft int,
|
|
@ifwidth int,
|
|
@ifheight int,
|
|
@sbeschreibung varchar(255),
|
|
@imandantnr int,
|
|
@isprache int,
|
|
@baktiv bit,
|
|
@daerstellt_am datetime,
|
|
@damutiert_am datetime,
|
|
@imutierer int,
|
|
@sDomaintable varchar(255),
|
|
@sKeyFields varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[sysadminfunktion]
|
|
SET
|
|
[bezeichnung] = @sbezeichnung,
|
|
[ParentID] = @iParentID,
|
|
[Sort] = @iSort,
|
|
[ImageIndex] = @iImageIndex,
|
|
[ImageIndexOpen] = @iImageIndexOpen,
|
|
[ftop] = @iftop,
|
|
[fleft] = @ifleft,
|
|
[fwidth] = @ifwidth,
|
|
[fheight] = @ifheight,
|
|
[beschreibung] = @sbeschreibung,
|
|
[mandantnr] = @imandantnr,
|
|
[sprache] = @isprache,
|
|
[aktiv] = @baktiv,
|
|
[erstellt_am] = @daerstellt_am,
|
|
[mutiert_am] = @damutiert_am,
|
|
[mutierer] = @imutierer,
|
|
[Domaintable] = @sDomaintable,
|
|
[KeyFields] = @sKeyFields
|
|
WHERE
|
|
[sysadminfnktnr] = @isysadminfnktnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Tooltip_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Tooltip'
|
|
-- using the Primary Key.
|
|
-- Gets: @iToolTipNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Tooltip_Delete]
|
|
@iToolTipNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Tooltip]
|
|
WHERE
|
|
[ToolTipNr] = @iToolTipNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Tooltip_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Tooltip'
|
|
-- Gets: @iToolTipNr int
|
|
-- Gets: @sFormularname varchar(50)
|
|
-- Gets: @sControlName varchar(50)
|
|
-- Gets: @sToolTip varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Tooltip_Insert]
|
|
@iToolTipNr int,
|
|
@sFormularname varchar(50),
|
|
@sControlName varchar(50),
|
|
@sToolTip 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].[Tooltip]
|
|
(
|
|
[ToolTipNr],
|
|
[Formularname],
|
|
[ControlName],
|
|
[ToolTip],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
)
|
|
VALUES
|
|
(
|
|
@iToolTipNr,
|
|
@sFormularname,
|
|
@sControlName,
|
|
@sToolTip,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Tooltip_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Tooltip'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Tooltip_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[ToolTipNr],
|
|
[Formularname],
|
|
[ControlName],
|
|
[ToolTip],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Tooltip]
|
|
ORDER BY
|
|
[ToolTipNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Tooltip_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Tooltip'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iToolTipNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Tooltip_SelectOne]
|
|
@iToolTipNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[ToolTipNr],
|
|
[Formularname],
|
|
[ControlName],
|
|
[ToolTip],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Tooltip]
|
|
WHERE
|
|
[ToolTipNr] = @iToolTipNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Tooltip_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Tooltip'
|
|
-- Gets: @iToolTipNr int
|
|
-- Gets: @sFormularname varchar(50)
|
|
-- Gets: @sControlName varchar(50)
|
|
-- Gets: @sToolTip varchar(1024)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Tooltip_Update]
|
|
@iToolTipNr int,
|
|
@sFormularname varchar(50),
|
|
@sControlName varchar(50),
|
|
@sToolTip 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].[Tooltip]
|
|
SET
|
|
[Formularname] = @sFormularname,
|
|
[ControlName] = @sControlName,
|
|
[ToolTip] = @sToolTip,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer
|
|
WHERE
|
|
[ToolTipNr] = @iToolTipNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Vertragselement'
|
|
-- using the Primary Key.
|
|
-- Gets: @iVertragselementnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Delete]
|
|
@iVertragselementnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Vertragselement]
|
|
WHERE
|
|
[Vertragselementnr] = @iVertragselementnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_DeleteAllWVertragspartnerNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Vertragselement'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_DeleteAllWVertragspartnerNrLogic]
|
|
@iVertragspartnerNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Vertragselement]
|
|
WHERE
|
|
[VertragspartnerNr] = @iVertragspartnerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_DeleteAllWVertragstypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Vertragselement'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragstypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_DeleteAllWVertragstypNrLogic]
|
|
@iVertragstypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Vertragselement]
|
|
WHERE
|
|
[VertragstypNr] = @iVertragstypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Vertragselement'
|
|
-- Gets: @iVertragselementnr int
|
|
-- Gets: @iVertragstypNr int
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(2048)
|
|
-- Gets: @sVersion varchar(50)
|
|
-- Gets: @daVersionsdatum datetime
|
|
-- Gets: @sNummer varchar(50)
|
|
-- Gets: @daUnterzeichnet_am datetime
|
|
-- Gets: @daVertragsbeginn datetime
|
|
-- Gets: @daVertragsablauf datetime
|
|
-- Gets: @bBefristet_Unbefristet bit
|
|
-- Gets: @daMindestvertragsdauer_bis datetime
|
|
-- Gets: @daGekuendigt_am datetime
|
|
-- Gets: @daGekuendigt_per datetime
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @sSuchbegriffe varchar(1024)
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iLizenztypnr int
|
|
-- Gets: @sLizenzdetails varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Insert]
|
|
@iVertragselementnr int,
|
|
@iVertragstypNr int,
|
|
@iVertragspartnerNr int,
|
|
@iParentID int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(2048),
|
|
@sVersion varchar(50),
|
|
@daVersionsdatum datetime,
|
|
@sNummer varchar(50),
|
|
@daUnterzeichnet_am datetime,
|
|
@daVertragsbeginn datetime,
|
|
@daVertragsablauf datetime,
|
|
@bBefristet_Unbefristet bit,
|
|
@daMindestvertragsdauer_bis datetime,
|
|
@daGekuendigt_am datetime,
|
|
@daGekuendigt_per datetime,
|
|
@iSecurityLevelNr int,
|
|
@sSuchbegriffe varchar(1024),
|
|
@iApplikationNr int,
|
|
@iLizenztypnr int,
|
|
@sLizenzdetails 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].[Vertragselement]
|
|
(
|
|
[Vertragselementnr],
|
|
[VertragstypNr],
|
|
[VertragspartnerNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Version],
|
|
[Versionsdatum],
|
|
[Nummer],
|
|
[Unterzeichnet_am],
|
|
[Vertragsbeginn],
|
|
[Vertragsablauf],
|
|
[Befristet_Unbefristet],
|
|
[Mindestvertragsdauer_bis],
|
|
[Gekuendigt_am],
|
|
[Gekuendigt_per],
|
|
[SecurityLevelNr],
|
|
[Suchbegriffe],
|
|
[ApplikationNr],
|
|
[Lizenztypnr],
|
|
[Lizenzdetails],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@iVertragselementnr,
|
|
@iVertragstypNr,
|
|
@iVertragspartnerNr,
|
|
@iParentID,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@sVersion,
|
|
@daVersionsdatum,
|
|
@sNummer,
|
|
@daUnterzeichnet_am,
|
|
@daVertragsbeginn,
|
|
@daVertragsablauf,
|
|
@bBefristet_Unbefristet,
|
|
@daMindestvertragsdauer_bis,
|
|
@daGekuendigt_am,
|
|
@daGekuendigt_per,
|
|
@iSecurityLevelNr,
|
|
@sSuchbegriffe,
|
|
@iApplikationNr,
|
|
@iLizenztypnr,
|
|
@sLizenzdetails,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Referenz_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Vertragselement_Referenz'
|
|
-- using the Primary Key.
|
|
-- Gets: @iReferenzvertragsnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Referenz_Delete]
|
|
@iReferenzvertragsnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Vertragselement_Referenz]
|
|
WHERE
|
|
[Referenzvertragsnr] = @iReferenzvertragsnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Referenz_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Vertragselement_Referenz'
|
|
-- Gets: @iReferenzvertragsnr int
|
|
-- Gets: @iVertragselementnr_1 int
|
|
-- Gets: @iVertragselementnr_2 int
|
|
-- Gets: @iBeziehungstypNr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Referenz_Insert]
|
|
@iReferenzvertragsnr int,
|
|
@iVertragselementnr_1 int,
|
|
@iVertragselementnr_2 int,
|
|
@iBeziehungstypNr int,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Vertragselement_Referenz]
|
|
(
|
|
[Referenzvertragsnr],
|
|
[Vertragselementnr_1],
|
|
[Vertragselementnr_2],
|
|
[BeziehungstypNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iReferenzvertragsnr,
|
|
@iVertragselementnr_1,
|
|
@iVertragselementnr_2,
|
|
@iBeziehungstypNr,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@iSecurityLevelNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Referenz_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Vertragselement_Referenz'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Referenz_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Referenzvertragsnr],
|
|
[Vertragselementnr_1],
|
|
[Vertragselementnr_2],
|
|
[BeziehungstypNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Vertragselement_Referenz]
|
|
ORDER BY
|
|
[Referenzvertragsnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Referenz_selectall_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Referenz_selectall_bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SELECT 1 as Owner, Vertragselement_1.Bezeichnung AS Vertragselement_1, dbo.Beziehungstyp.Bezeichnung AS Beziehung, dbo.Vertragselement.Bezeichnung AS Vertragselement_2,
|
|
dbo.Vertragselement_Referenz.Referenzvertragsnr, dbo.Vertragselement_Referenz.Vertragselementnr_1, dbo.Vertragselement_Referenz.Vertragselementnr_2,
|
|
dbo.Vertragselement_Referenz.Bemerkung, dbo.Vertragselement_Referenz.Aktiv, dbo.Vertragselement_Referenz.Erstellt_am,
|
|
dbo.Vertragselement_Referenz.Mutiert_am, dbo.Vertragselement_Referenz.Mutierer, dbo.Vertragselement_Referenz.Mandantnr,
|
|
dbo.Vertragselement_Referenz.SecurityLevelNr
|
|
into #tmp_daten
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Beziehungstyp INNER JOIN
|
|
dbo.Vertragselement_Referenz ON dbo.Beziehungstyp.BeziehungstypNr = dbo.Vertragselement_Referenz.BeziehungstypNr INNER JOIN
|
|
dbo.Vertragselement AS Vertragselement_1 ON dbo.Vertragselement_Referenz.Vertragselementnr_1 = Vertragselement_1.Vertragselementnr ON
|
|
dbo.Vertragselement.Vertragselementnr = dbo.Vertragselement_Referenz.Vertragselementnr_2
|
|
where vertragselement_referenz.Vertragselementnr_1=@keyvalue and
|
|
dbo.vertragselement_referenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
|
|
|
|
insert #tmp_daten
|
|
SELECT 0 as Owner, Vertragselement_1.Bezeichnung AS Vertragselement_1, dbo.Beziehungstyp.Bezeichnung2 AS Beziehung, dbo.Vertragselement.Bezeichnung AS Vertragselement_2,
|
|
dbo.Vertragselement_Referenz.Referenzvertragsnr, dbo.Vertragselement_Referenz.Vertragselementnr_1, dbo.Vertragselement_Referenz.Vertragselementnr_2,
|
|
dbo.Vertragselement_Referenz.Bemerkung, dbo.Vertragselement_Referenz.Aktiv, dbo.Vertragselement_Referenz.Erstellt_am,
|
|
dbo.Vertragselement_Referenz.Mutiert_am, dbo.Vertragselement_Referenz.Mutierer, dbo.Vertragselement_Referenz.Mandantnr,
|
|
dbo.Vertragselement_Referenz.SecurityLevelNr
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Beziehungstyp INNER JOIN
|
|
dbo.Vertragselement_Referenz ON dbo.Beziehungstyp.BeziehungstypNr = dbo.Vertragselement_Referenz.BeziehungstypNr INNER JOIN
|
|
dbo.Vertragselement AS Vertragselement_1 ON dbo.Vertragselement_Referenz.Vertragselementnr_1 = Vertragselement_1.Vertragselementnr ON
|
|
dbo.Vertragselement.Vertragselementnr = dbo.Vertragselement_Referenz.Vertragselementnr_2
|
|
|
|
where vertragselement_referenz.Vertragselementnr_2=@keyvalue and
|
|
dbo.vertragselement_referenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
|
|
select * from #tmp_daten
|
|
|
|
ORDER BY
|
|
[referenzvertragsnr] desc
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Referenz_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Vertragselement_Referenz'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iReferenzvertragsnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Referenz_SelectOne]
|
|
@iReferenzvertragsnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Referenzvertragsnr],
|
|
[Vertragselementnr_1],
|
|
[Vertragselementnr_2],
|
|
[BeziehungstypNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Vertragselement_Referenz]
|
|
WHERE
|
|
[Referenzvertragsnr] = @iReferenzvertragsnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Referenz_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Vertragselement_Referenz'
|
|
-- Gets: @iReferenzvertragsnr int
|
|
-- Gets: @iVertragselementnr_1 int
|
|
-- Gets: @iVertragselementnr_2 int
|
|
-- Gets: @iBeziehungstypNr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Referenz_Update]
|
|
@iReferenzvertragsnr int,
|
|
@iVertragselementnr_1 int,
|
|
@iVertragselementnr_2 int,
|
|
@iBeziehungstypNr int,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragselement_Referenz]
|
|
SET
|
|
[Vertragselementnr_1] = @iVertragselementnr_1,
|
|
[Vertragselementnr_2] = @iVertragselementnr_2,
|
|
[BeziehungstypNr] = @iBeziehungstypNr,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
WHERE
|
|
[Referenzvertragsnr] = @iReferenzvertragsnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Vertragselement'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Vertragselementnr],
|
|
[VertragstypNr],
|
|
[VertragspartnerNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Version],
|
|
[Versionsdatum],
|
|
[Nummer],
|
|
[Unterzeichnet_am],
|
|
[Vertragsbeginn],
|
|
[Vertragsablauf],
|
|
[Befristet_Unbefristet],
|
|
[Mindestvertragsdauer_bis],
|
|
[Gekuendigt_am],
|
|
[Gekuendigt_per],
|
|
[SecurityLevelNr],
|
|
[Suchbegriffe],
|
|
[ApplikationNr],
|
|
[Lizenztypnr],
|
|
[Lizenzdetails],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Vertragselement]
|
|
ORDER BY
|
|
[Vertragselementnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_SelectAllWVertragspartnerNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Vertragselement'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_SelectAllWVertragspartnerNrLogic]
|
|
@iVertragspartnerNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[Vertragselementnr],
|
|
[VertragstypNr],
|
|
[VertragspartnerNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Version],
|
|
[Versionsdatum],
|
|
[Nummer],
|
|
[Unterzeichnet_am],
|
|
[Vertragsbeginn],
|
|
[Vertragsablauf],
|
|
[Befristet_Unbefristet],
|
|
[Mindestvertragsdauer_bis],
|
|
[Gekuendigt_am],
|
|
[Gekuendigt_per],
|
|
[SecurityLevelNr],
|
|
[Suchbegriffe],
|
|
[ApplikationNr],
|
|
[Lizenztypnr],
|
|
[Lizenzdetails],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Vertragselement]
|
|
WHERE
|
|
[VertragspartnerNr] = @iVertragspartnerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_SelectAllWVertragstypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Vertragselement'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragstypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_SelectAllWVertragstypNrLogic]
|
|
@iVertragstypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[Vertragselementnr],
|
|
[VertragstypNr],
|
|
[VertragspartnerNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Version],
|
|
[Versionsdatum],
|
|
[Nummer],
|
|
[Unterzeichnet_am],
|
|
[Vertragsbeginn],
|
|
[Vertragsablauf],
|
|
[Befristet_Unbefristet],
|
|
[Mindestvertragsdauer_bis],
|
|
[Gekuendigt_am],
|
|
[Gekuendigt_per],
|
|
[SecurityLevelNr],
|
|
[Suchbegriffe],
|
|
[ApplikationNr],
|
|
[Lizenztypnr],
|
|
[Lizenzdetails],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Vertragselement]
|
|
WHERE
|
|
[VertragstypNr] = @iVertragstypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Vertragselement'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iVertragselementnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_SelectOne]
|
|
@iVertragselementnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Vertragselementnr],
|
|
[VertragstypNr],
|
|
[VertragspartnerNr],
|
|
[ParentID],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Version],
|
|
[Versionsdatum],
|
|
[Nummer],
|
|
[Unterzeichnet_am],
|
|
[Vertragsbeginn],
|
|
[Vertragsablauf],
|
|
[Befristet_Unbefristet],
|
|
[Mindestvertragsdauer_bis],
|
|
[Gekuendigt_am],
|
|
[Gekuendigt_per],
|
|
[SecurityLevelNr],
|
|
[Suchbegriffe],
|
|
[ApplikationNr],
|
|
[Lizenztypnr],
|
|
[Lizenzdetails],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Vertragselement]
|
|
WHERE
|
|
[Vertragselementnr] = @iVertragselementnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Vertragselement'
|
|
-- Gets: @iVertragselementnr int
|
|
-- Gets: @iVertragstypNr int
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Gets: @iParentID int
|
|
-- Gets: @sBezeichnung varchar(255)
|
|
-- Gets: @sBeschreibung varchar(2048)
|
|
-- Gets: @sVersion varchar(50)
|
|
-- Gets: @daVersionsdatum datetime
|
|
-- Gets: @sNummer varchar(50)
|
|
-- Gets: @daUnterzeichnet_am datetime
|
|
-- Gets: @daVertragsbeginn datetime
|
|
-- Gets: @daVertragsablauf datetime
|
|
-- Gets: @bBefristet_Unbefristet bit
|
|
-- Gets: @daMindestvertragsdauer_bis datetime
|
|
-- Gets: @daGekuendigt_am datetime
|
|
-- Gets: @daGekuendigt_per datetime
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @sSuchbegriffe varchar(1024)
|
|
-- Gets: @iApplikationNr int
|
|
-- Gets: @iLizenztypnr int
|
|
-- Gets: @sLizenzdetails varchar(255)
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_Update]
|
|
@iVertragselementnr int,
|
|
@iVertragstypNr int,
|
|
@iVertragspartnerNr int,
|
|
@iParentID int,
|
|
@sBezeichnung varchar(255),
|
|
@sBeschreibung varchar(2048),
|
|
@sVersion varchar(50),
|
|
@daVersionsdatum datetime,
|
|
@sNummer varchar(50),
|
|
@daUnterzeichnet_am datetime,
|
|
@daVertragsbeginn datetime,
|
|
@daVertragsablauf datetime,
|
|
@bBefristet_Unbefristet bit,
|
|
@daMindestvertragsdauer_bis datetime,
|
|
@daGekuendigt_am datetime,
|
|
@daGekuendigt_per datetime,
|
|
@iSecurityLevelNr int,
|
|
@sSuchbegriffe varchar(1024),
|
|
@iApplikationNr int,
|
|
@iLizenztypnr int,
|
|
@sLizenzdetails 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].[Vertragselement]
|
|
SET
|
|
[VertragstypNr] = @iVertragstypNr,
|
|
[VertragspartnerNr] = @iVertragspartnerNr,
|
|
[ParentID] = @iParentID,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Version] = @sVersion,
|
|
[Versionsdatum] = @daVersionsdatum,
|
|
[Nummer] = @sNummer,
|
|
[Unterzeichnet_am] = @daUnterzeichnet_am,
|
|
[Vertragsbeginn] = @daVertragsbeginn,
|
|
[Vertragsablauf] = @daVertragsablauf,
|
|
[Befristet_Unbefristet] = @bBefristet_Unbefristet,
|
|
[Mindestvertragsdauer_bis] = @daMindestvertragsdauer_bis,
|
|
[Gekuendigt_am] = @daGekuendigt_am,
|
|
[Gekuendigt_per] = @daGekuendigt_per,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[Suchbegriffe] = @sSuchbegriffe,
|
|
[ApplikationNr] = @iApplikationNr,
|
|
[Lizenztypnr] = @iLizenztypnr,
|
|
[Lizenzdetails] = @sLizenzdetails,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv
|
|
WHERE
|
|
[Vertragselementnr] = @iVertragselementnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_UpdateAllWVertragspartnerNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Vertragselement'.
|
|
-- Will reset field [VertragspartnerNr] with value @iVertragspartnerNrOld to value @iVertragspartnerNr
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Gets: @iVertragspartnerNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_UpdateAllWVertragspartnerNrLogic]
|
|
@iVertragspartnerNr int,
|
|
@iVertragspartnerNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragselement]
|
|
SET
|
|
[VertragspartnerNr] = @iVertragspartnerNr
|
|
WHERE
|
|
[VertragspartnerNr] = @iVertragspartnerNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragselement_UpdateAllWVertragstypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Vertragselement'.
|
|
-- Will reset field [VertragstypNr] with value @iVertragstypNrOld to value @iVertragstypNr
|
|
-- Gets: @iVertragstypNr int
|
|
-- Gets: @iVertragstypNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragselement_UpdateAllWVertragstypNrLogic]
|
|
@iVertragstypNr int,
|
|
@iVertragstypNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragselement]
|
|
SET
|
|
[VertragstypNr] = @iVertragstypNr
|
|
WHERE
|
|
[VertragstypNr] = @iVertragstypNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_VertragselementApplikation_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'VertragselementApplikation'
|
|
-- using the Primary Key.
|
|
-- Gets: @iVertragselementApplikationnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_VertragselementApplikation_Delete]
|
|
@iVertragselementApplikationnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[VertragselementApplikation]
|
|
WHERE
|
|
[VertragselementApplikationnr] = @iVertragselementApplikationnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_VertragselementApplikation_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'VertragselementApplikation'
|
|
-- Gets: @iVertragselementApplikationnr int
|
|
-- Gets: @iVertragselementnr int
|
|
-- Gets: @iApplikationnr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iApplikationVersionNr int
|
|
-- Gets: @sBezeichnungLizenverwaltung varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_VertragselementApplikation_Insert]
|
|
@iVertragselementApplikationnr int,
|
|
@iVertragselementnr int,
|
|
@iApplikationnr int,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationVersionNr int,
|
|
@sBezeichnungLizenverwaltung varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[VertragselementApplikation]
|
|
(
|
|
[VertragselementApplikationnr],
|
|
[Vertragselementnr],
|
|
[Applikationnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[ApplikationVersionNr],
|
|
[BezeichnungLizenverwaltung]
|
|
)
|
|
VALUES
|
|
(
|
|
@iVertragselementApplikationnr,
|
|
@iVertragselementnr,
|
|
@iApplikationnr,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iApplikationVersionNr,
|
|
@sBezeichnungLizenverwaltung
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_VertragselementApplikation_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'VertragselementApplikation'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_VertragselementApplikation_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[VertragselementApplikationnr],
|
|
[Vertragselementnr],
|
|
[Applikationnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[ApplikationVersionNr],
|
|
[BezeichnungLizenverwaltung]
|
|
FROM [dbo].[VertragselementApplikation]
|
|
ORDER BY
|
|
[VertragselementApplikationnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_VertragselementApplikation_selectall_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
Create PROCEDURE [dbo].[pr_VertragselementApplikation_selectall_bottomtable]
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
if @fokus=0 begin
|
|
|
|
-- SELECT 0 AS VertragselementApplikationNr, dbo.Vertragselement.Vertragselementnr, dbo.Applikation.ApplikationNr, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
-- dbo.Applikation.Bezeichnung AS Applikation, '' AS Bemerkung, dbo.Applikation.Aktiv, dbo.Applikation.Erstellt_am, dbo.Applikation.Mutiert_am,
|
|
-- dbo.Applikation.Mutierer
|
|
-- FROM dbo.Vertragselement INNER JOIN
|
|
-- dbo.Applikation ON dbo.Vertragselement.ApplikationNr = dbo.Applikation.ApplikationNr
|
|
-- WHERE (dbo.Vertragselement.Vertragselementnr = @keyvalue)
|
|
-- 20091026
|
|
|
|
|
|
--SELECT dbo.VertragselementApplikation.VertragselementApplikationnr, dbo.VertragselementApplikation.Vertragselementnr,
|
|
-- dbo.VertragselementApplikation.Applikationnr, dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Applikation.Bezeichnung AS Applikation,
|
|
-- dbo.VertragselementApplikation.Bemerkung, dbo.VertragselementApplikation.Aktiv, dbo.VertragselementApplikation.Erstellt_am,
|
|
-- dbo.VertragselementApplikation.Mutiert_am, dbo.VertragselementApplikation.Mutierer, 0 AS Lizenzen
|
|
--into #tmpa
|
|
--FROM dbo.VertragselementApplikation INNER JOIN
|
|
-- dbo.Vertragselement ON dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
-- dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr
|
|
|
|
--WHERE (dbo.VertragselementApplikation.Vertragselementnr = @keyvalue) AND (dbo.Applikation.SecurityLevelNr <= dbo.Get_SecurityLevel(@mitarbeiternr))
|
|
--ORDER BY Applikation
|
|
|
|
|
|
SELECT TOP (100) PERCENT dbo.VertragselementApplikation.VertragselementApplikationnr, dbo.VertragselementApplikation.Vertragselementnr,
|
|
dbo.VertragselementApplikation.Applikationnr, dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Applikation.Bezeichnung AS Applikation,
|
|
dbo.VertragselementApplikation.Bemerkung, dbo.VertragselementApplikation.Aktiv, dbo.VertragselementApplikation.Erstellt_am,
|
|
dbo.VertragselementApplikation.Mutiert_am, dbo.VertragselementApplikation.Mutierer, 0 AS Lizenzen, dbo.ApplikationVersion.Version,
|
|
dbo.ApplikationVersion.ApplikationNr AS Expr1, dbo.VertragselementApplikation.ApplikationVersionNr
|
|
into #tmpa
|
|
FROM dbo.VertragselementApplikation INNER JOIN
|
|
dbo.Vertragselement ON dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr LEFT OUTER JOIN
|
|
dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr
|
|
|
|
WHERE (dbo.VertragselementApplikation.Vertragselementnr = @keyvalue) AND (dbo.Applikation.SecurityLevelNr <= dbo.Get_SecurityLevel(@mitarbeiternr))
|
|
-- and dbo.VertragselementApplikation.Aktiv=1
|
|
ORDER BY Applikation
|
|
|
|
declare @vnr int
|
|
declare @venr int
|
|
declare @anr int
|
|
declare @cnt int
|
|
declare @avnr int
|
|
declare xc cursor for
|
|
select vertragselementapplikationnr, vertragselementnr, applikationnr, applikationversionnr from #tmpa
|
|
open xc
|
|
fetch next from xc into @vnr, @venr, @anr, @avnr
|
|
while @@FETCH_STATUS=0 begin
|
|
select @cnt=COUNT(*) from Lizenzkauf where vertragselementapplikationnr=@vnr and Aktiv=1
|
|
if @cnt > 0 update #tmpa set lizenzen=1 where VertragselementApplikationnr=@vnr
|
|
fetch next from xc into @vnr, @venr, @anr,@avnr
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
select * from #tmpa
|
|
drop table #tmpa
|
|
end else begin
|
|
SELECT dbo.VertragselementApplikation.VertragselementApplikationnr,
|
|
dbo.VertragselementApplikation.Vertragselementnr,
|
|
dbo.VertragselementApplikation.Applikationnr,
|
|
dbo.Vertragselement.Bezeichnung as Vertragselement, dbo.Applikation.Bezeichnung AS Applikation,
|
|
dbo.VertragselementApplikation.Bemerkung, dbo.VertragselementApplikation.Aktiv,
|
|
dbo.VertragselementApplikation.Erstellt_am, dbo.VertragselementApplikation.Mutiert_am,
|
|
dbo.VertragselementApplikation.Mutierer
|
|
FROM dbo.VertragselementApplikation INNER JOIN
|
|
dbo.Vertragselement ON dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr
|
|
where dbo.vertragselementapplikation.applikationnr=@keyvalue and
|
|
dbo.vertragselement.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
order by dbo.applikation.bezeichnung
|
|
end
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_VertragselementApplikation_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'VertragselementApplikation'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iVertragselementApplikationnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_VertragselementApplikation_SelectOne]
|
|
@iVertragselementApplikationnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[VertragselementApplikationnr],
|
|
[Vertragselementnr],
|
|
[Applikationnr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[ApplikationVersionNr],
|
|
[BezeichnungLizenverwaltung]
|
|
FROM [dbo].[VertragselementApplikation]
|
|
WHERE
|
|
[VertragselementApplikationnr] = @iVertragselementApplikationnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_VertragselementApplikation_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'VertragselementApplikation'
|
|
-- Gets: @iVertragselementApplikationnr int
|
|
-- Gets: @iVertragselementnr int
|
|
-- Gets: @iApplikationnr int
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iApplikationVersionNr int
|
|
-- Gets: @sBezeichnungLizenverwaltung varchar(255)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_VertragselementApplikation_Update]
|
|
@iVertragselementApplikationnr int,
|
|
@iVertragselementnr int,
|
|
@iApplikationnr int,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iApplikationVersionNr int,
|
|
@sBezeichnungLizenverwaltung varchar(255),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[VertragselementApplikation]
|
|
SET
|
|
[Vertragselementnr] = @iVertragselementnr,
|
|
[Applikationnr] = @iApplikationnr,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[ApplikationVersionNr] = @iApplikationVersionNr,
|
|
[BezeichnungLizenverwaltung] = @sBezeichnungLizenverwaltung
|
|
WHERE
|
|
[VertragselementApplikationnr] = @iVertragselementApplikationnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Vertragsereignis'
|
|
-- using the Primary Key.
|
|
-- Gets: @iEreignisNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_Delete]
|
|
@iEreignisNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[EreignisNr] = @iEreignisNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_DeleteAllWEreignistypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iEreignistypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_DeleteAllWEreignistypNrLogic]
|
|
@iEreignistypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[EreignistypNr] = @iEreignistypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_DeleteAllWKostenartNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iKostenartNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_DeleteAllWKostenartNrLogic]
|
|
@iKostenartNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[KostenartNr] = @iKostenartNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_DeleteAllWPeriodizitaetNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_DeleteAllWPeriodizitaetNrLogic]
|
|
@iPeriodizitaetNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[PeriodizitaetNr] = @iPeriodizitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_DeleteAllWVertragselementnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragselementnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_DeleteAllWVertragselementnrLogic]
|
|
@iVertragselementnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE one or more existing rows from the table.
|
|
DELETE
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[Vertragselementnr] = @iVertragselementnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Vertragsereignis'
|
|
-- Gets: @iEreignisNr int
|
|
-- Gets: @iVertragselementnr int
|
|
-- Gets: @iEreignistypNr int
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @fBetrag float(53)
|
|
-- Gets: @bInklMwSt bit
|
|
-- Gets: @daDatum datetime
|
|
-- Gets: @daStart datetime
|
|
-- Gets: @daEnde datetime
|
|
-- Gets: @iVorlaufzeit int
|
|
-- Gets: @iKostenartNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iKuendigungsfristnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_Insert]
|
|
@iEreignisNr int,
|
|
@iVertragselementnr int,
|
|
@iEreignistypNr int,
|
|
@iPeriodizitaetNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@fBetrag float(53),
|
|
@bInklMwSt bit,
|
|
@daDatum datetime,
|
|
@daStart datetime,
|
|
@daEnde datetime,
|
|
@iVorlaufzeit int,
|
|
@iKostenartNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSecurityLevelNr int,
|
|
@iKuendigungsfristnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Vertragsereignis]
|
|
(
|
|
[EreignisNr],
|
|
[Vertragselementnr],
|
|
[EreignistypNr],
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Betrag],
|
|
[InklMwSt],
|
|
[Datum],
|
|
[Start],
|
|
[Ende],
|
|
[Vorlaufzeit],
|
|
[KostenartNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[Kuendigungsfristnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iEreignisNr,
|
|
@iVertragselementnr,
|
|
@iEreignistypNr,
|
|
@iPeriodizitaetNr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@fBetrag,
|
|
@bInklMwSt,
|
|
@daDatum,
|
|
@daStart,
|
|
@daEnde,
|
|
@iVorlaufzeit,
|
|
@iKostenartNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantNr,
|
|
@iSecurityLevelNr,
|
|
@iKuendigungsfristnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Vertragsereignis'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[EreignisNr],
|
|
[Vertragselementnr],
|
|
[EreignistypNr],
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Betrag],
|
|
[InklMwSt],
|
|
[Datum],
|
|
[Start],
|
|
[Ende],
|
|
[Vorlaufzeit],
|
|
[KostenartNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[Kuendigungsfristnr]
|
|
FROM [dbo].[Vertragsereignis]
|
|
ORDER BY
|
|
[EreignisNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
|
|
AS
|
|
SELECT dbo.Vertragsereignis.EreignisNr, dbo.Vertragsereignis.Vertragselementnr, dbo.Vertragsereignis.Bezeichnung,
|
|
dbo.Ereignistyp.Bezeichnung AS Ereignistyp, dbo.Periodizitaet.Bezeichnung AS Periodizität, dbo.Kostenart.Bezeichnung AS Kostenart,
|
|
dbo.Vertragsereignis.Beschreibung, dbo.Vertragsereignis.Betrag, dbo.check_date(dbo.Vertragsereignis.Datum) as Datum, dbo.check_date(dbo.Vertragsereignis.Start) as Start, dbo.check_date(dbo.Vertragsereignis.Ende) as Ende,
|
|
dbo.Vertragsereignis.Vorlaufzeit, dbo.Vertragsereignis.Aktiv, dbo.Vertragsereignis.Erstellt_am, dbo.Vertragsereignis.Mutiert_am, dbo.Vertragsereignis.Mutierer,
|
|
dbo.Vertragsereignis.MandantNr, dbo.Vertragsereignis.SecurityLevelNr
|
|
FROM dbo.Vertragsereignis INNER JOIN
|
|
dbo.Kostenart ON dbo.Vertragsereignis.KostenartNr = dbo.Kostenart.KostenartNr INNER JOIN
|
|
dbo.Ereignistyp ON dbo.Vertragsereignis.EreignistypNr = dbo.Ereignistyp.Ereignistypnr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Vertragsereignis.PeriodizitaetNr = dbo.Periodizitaet.PeriodizitaetNr
|
|
where dbo.vertragsereignis.vertragselementnr = @keyvalue and
|
|
dbo.vertragsereignis.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_SelectAllWEreignistypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iEreignistypNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_SelectAllWEreignistypNrLogic]
|
|
@iEreignistypNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[EreignisNr],
|
|
[Vertragselementnr],
|
|
[EreignistypNr],
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Betrag],
|
|
[InklMwSt],
|
|
[Datum],
|
|
[Start],
|
|
[Ende],
|
|
[Vorlaufzeit],
|
|
[KostenartNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[Kuendigungsfristnr]
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[EreignistypNr] = @iEreignistypNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_SelectAllWKostenartNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iKostenartNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_SelectAllWKostenartNrLogic]
|
|
@iKostenartNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[EreignisNr],
|
|
[Vertragselementnr],
|
|
[EreignistypNr],
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Betrag],
|
|
[InklMwSt],
|
|
[Datum],
|
|
[Start],
|
|
[Ende],
|
|
[Vorlaufzeit],
|
|
[KostenartNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[Kuendigungsfristnr]
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[KostenartNr] = @iKostenartNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_SelectAllWPeriodizitaetNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_SelectAllWPeriodizitaetNrLogic]
|
|
@iPeriodizitaetNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[EreignisNr],
|
|
[Vertragselementnr],
|
|
[EreignistypNr],
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Betrag],
|
|
[InklMwSt],
|
|
[Datum],
|
|
[Start],
|
|
[Ende],
|
|
[Vorlaufzeit],
|
|
[KostenartNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[PeriodizitaetNr] = @iPeriodizitaetNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_SelectAllWVertragselementnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select one or more existing rows from the table 'Vertragsereignis'
|
|
-- based on a foreign key field.
|
|
-- Gets: @iVertragselementnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_SelectAllWVertragselementnrLogic]
|
|
@iVertragselementnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT one or more existing rows from the table.
|
|
SELECT
|
|
[EreignisNr],
|
|
[Vertragselementnr],
|
|
[EreignistypNr],
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Betrag],
|
|
[InklMwSt],
|
|
[Datum],
|
|
[Start],
|
|
[Ende],
|
|
[Vorlaufzeit],
|
|
[KostenartNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[Kuendigungsfristnr]
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[Vertragselementnr] = @iVertragselementnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Vertragsereignis'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iEreignisNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_SelectOne]
|
|
@iEreignisNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[EreignisNr],
|
|
[Vertragselementnr],
|
|
[EreignistypNr],
|
|
[PeriodizitaetNr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Betrag],
|
|
[InklMwSt],
|
|
[Datum],
|
|
[Start],
|
|
[Ende],
|
|
[Vorlaufzeit],
|
|
[KostenartNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[MandantNr],
|
|
[SecurityLevelNr],
|
|
[Kuendigungsfristnr]
|
|
FROM [dbo].[Vertragsereignis]
|
|
WHERE
|
|
[EreignisNr] = @iEreignisNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Vertragsereignis'
|
|
-- Gets: @iEreignisNr int
|
|
-- Gets: @iVertragselementnr int
|
|
-- Gets: @iEreignistypNr int
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @fBetrag float(53)
|
|
-- Gets: @bInklMwSt bit
|
|
-- Gets: @daDatum datetime
|
|
-- Gets: @daStart datetime
|
|
-- Gets: @daEnde datetime
|
|
-- Gets: @iVorlaufzeit int
|
|
-- Gets: @iKostenartNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantNr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @iKuendigungsfristnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_Update]
|
|
@iEreignisNr int,
|
|
@iVertragselementnr int,
|
|
@iEreignistypNr int,
|
|
@iPeriodizitaetNr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@fBetrag float(53),
|
|
@bInklMwSt bit,
|
|
@daDatum datetime,
|
|
@daStart datetime,
|
|
@daEnde datetime,
|
|
@iVorlaufzeit int,
|
|
@iKostenartNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantNr int,
|
|
@iSecurityLevelNr int,
|
|
@iKuendigungsfristnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragsereignis]
|
|
SET
|
|
[Vertragselementnr] = @iVertragselementnr,
|
|
[EreignistypNr] = @iEreignistypNr,
|
|
[PeriodizitaetNr] = @iPeriodizitaetNr,
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Betrag] = @fBetrag,
|
|
[InklMwSt] = @bInklMwSt,
|
|
[Datum] = @daDatum,
|
|
[Start] = @daStart,
|
|
[Ende] = @daEnde,
|
|
[Vorlaufzeit] = @iVorlaufzeit,
|
|
[KostenartNr] = @iKostenartNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[MandantNr] = @iMandantNr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[Kuendigungsfristnr] = @iKuendigungsfristnr
|
|
WHERE
|
|
[EreignisNr] = @iEreignisNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_UpdateAllWEreignistypNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Vertragsereignis'.
|
|
-- Will reset field [EreignistypNr] with value @iEreignistypNrOld to value @iEreignistypNr
|
|
-- Gets: @iEreignistypNr int
|
|
-- Gets: @iEreignistypNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_UpdateAllWEreignistypNrLogic]
|
|
@iEreignistypNr int,
|
|
@iEreignistypNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragsereignis]
|
|
SET
|
|
[EreignistypNr] = @iEreignistypNr
|
|
WHERE
|
|
[EreignistypNr] = @iEreignistypNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_UpdateAllWKostenartNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Vertragsereignis'.
|
|
-- Will reset field [KostenartNr] with value @iKostenartNrOld to value @iKostenartNr
|
|
-- Gets: @iKostenartNr int
|
|
-- Gets: @iKostenartNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_UpdateAllWKostenartNrLogic]
|
|
@iKostenartNr int,
|
|
@iKostenartNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragsereignis]
|
|
SET
|
|
[KostenartNr] = @iKostenartNr
|
|
WHERE
|
|
[KostenartNr] = @iKostenartNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_UpdateAllWPeriodizitaetNrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Vertragsereignis'.
|
|
-- Will reset field [PeriodizitaetNr] with value @iPeriodizitaetNrOld to value @iPeriodizitaetNr
|
|
-- Gets: @iPeriodizitaetNr int
|
|
-- Gets: @iPeriodizitaetNrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_UpdateAllWPeriodizitaetNrLogic]
|
|
@iPeriodizitaetNr int,
|
|
@iPeriodizitaetNrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragsereignis]
|
|
SET
|
|
[PeriodizitaetNr] = @iPeriodizitaetNr
|
|
WHERE
|
|
[PeriodizitaetNr] = @iPeriodizitaetNrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsereignis_UpdateAllWVertragselementnrLogic] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update one or more existing rows in the table 'Vertragsereignis'.
|
|
-- Will reset field [Vertragselementnr] with value @iVertragselementnrOld to value @iVertragselementnr
|
|
-- Gets: @iVertragselementnr int
|
|
-- Gets: @iVertragselementnrOld int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsereignis_UpdateAllWVertragselementnrLogic]
|
|
@iVertragselementnr int,
|
|
@iVertragselementnrOld int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragsereignis]
|
|
SET
|
|
[Vertragselementnr] = @iVertragselementnr
|
|
WHERE
|
|
[Vertragselementnr] = @iVertragselementnrOld
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Vertragskontakt'
|
|
-- using the Primary Key.
|
|
-- Gets: @iVertragsKontaktNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragskontakt_Delete]
|
|
@iVertragsKontaktNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Vertragskontakt]
|
|
WHERE
|
|
[VertragsKontaktNr] = @iVertragsKontaktNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Vertragskontakt'
|
|
-- Gets: @iVertragsKontaktNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @iKontakttypNr int
|
|
-- Gets: @bIntern bit
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragskontakt_Insert]
|
|
@iVertragsKontaktNr int,
|
|
@iVertragselementNr int,
|
|
@iPersonNr int,
|
|
@iKontakttypNr int,
|
|
@bIntern bit,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Vertragskontakt]
|
|
(
|
|
[VertragsKontaktNr],
|
|
[VertragselementNr],
|
|
[PersonNr],
|
|
[KontakttypNr],
|
|
[Intern],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iVertragsKontaktNr,
|
|
@iVertragselementNr,
|
|
@iPersonNr,
|
|
@iKontakttypNr,
|
|
@bIntern,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@iSecurityLevelNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Vertragskontakt'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragskontakt_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[VertragsKontaktNr],
|
|
[VertragselementNr],
|
|
[PersonNr],
|
|
[KontakttypNr],
|
|
[Intern],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Vertragskontakt]
|
|
ORDER BY
|
|
[VertragsKontaktNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[pr_Vertragskontakt_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
|
|
|
|
SELECT dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Firma,
|
|
dbo.Person.Name + ' ' + dbo.Person.Vorname AS Kontaktperson, dbo.Person.Telefon, dbo.Person.Telefax, dbo.Person.EMail,
|
|
dbo.Kontakttyp.Bezeichnung AS Rolle, dbo.Vertragskontakt.Intern, dbo.Vertragskontakt.Bemerkung, dbo.Vertragskontakt.Aktiv,
|
|
dbo.Vertragskontakt.Erstellt_am, dbo.Vertragskontakt.Mutiert_am, dbo.Vertragskontakt.Mutierer, dbo.Vertragskontakt.Mandantnr,
|
|
dbo.Vertragskontakt.SecurityLevelNr, dbo.vertragskontakt.PersonNr, dbo.vertragskontakt.VertragskontaktNr
|
|
FROM dbo.Vertragskontakt INNER JOIN
|
|
dbo.Person ON dbo.Vertragskontakt.PersonNr = dbo.Person.PersonNr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Person.Vertragspartnernr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Kontakttyp ON dbo.Vertragskontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr
|
|
where dbo.Vertragskontakt.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and vertragselementnr = @keyvalue
|
|
ORDER BY
|
|
[vertragskontaktnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Vertragskontakt'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iVertragsKontaktNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragskontakt_SelectOne]
|
|
@iVertragsKontaktNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[VertragsKontaktNr],
|
|
[VertragselementNr],
|
|
[PersonNr],
|
|
[KontakttypNr],
|
|
[Intern],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Vertragskontakt]
|
|
WHERE
|
|
[VertragsKontaktNr] = @iVertragsKontaktNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragskontakt_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Vertragskontakt'
|
|
-- Gets: @iVertragsKontaktNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @iPersonNr int
|
|
-- Gets: @iKontakttypNr int
|
|
-- Gets: @bIntern bit
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragskontakt_Update]
|
|
@iVertragsKontaktNr int,
|
|
@iVertragselementNr int,
|
|
@iPersonNr int,
|
|
@iKontakttypNr int,
|
|
@bIntern bit,
|
|
@sBemerkung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragskontakt]
|
|
SET
|
|
[VertragselementNr] = @iVertragselementNr,
|
|
[PersonNr] = @iPersonNr,
|
|
[KontakttypNr] = @iKontakttypNr,
|
|
[Intern] = @bIntern,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
WHERE
|
|
[VertragsKontaktNr] = @iVertragsKontaktNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsleistung_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Vertragsleistung'
|
|
-- using the Primary Key.
|
|
-- Gets: @iVertragsleistungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsleistung_Delete]
|
|
@iVertragsleistungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Vertragsleistung]
|
|
WHERE
|
|
[VertragsleistungNr] = @iVertragsleistungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsleistung_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Vertragsleistung'
|
|
-- Gets: @iVertragsleistungNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @iServicekatalogNr int
|
|
-- Gets: @sBemerkung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsleistung_Insert]
|
|
@iVertragsleistungNr int,
|
|
@iVertragselementNr int,
|
|
@iServicekatalogNr int,
|
|
@sBemerkung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Vertragsleistung]
|
|
(
|
|
[VertragsleistungNr],
|
|
[VertragselementNr],
|
|
[ServicekatalogNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iVertragsleistungNr,
|
|
@iVertragselementNr,
|
|
@iServicekatalogNr,
|
|
@sBemerkung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@iSecurityLevelNr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsleistung_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Vertragsleistung'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsleistung_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[VertragsleistungNr],
|
|
[VertragselementNr],
|
|
[ServicekatalogNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Vertragsleistung]
|
|
ORDER BY
|
|
[VertragsleistungNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsleistung_SelectAll_bottomtable] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[pr_Vertragsleistung_SelectAll_bottomtable]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@iErrorCode int OUTPUT,
|
|
@Fokus int,
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
if @fokus = 0 begin
|
|
SELECT dbo.Vertragsleistung.VertragsleistungNr, dbo.Vertragsleistung.VertragselementNr, dbo.Vertragsleistung.ServicekatalogNr, dbo.Vertragsleistung.Bemerkung,
|
|
dbo.Vertragsleistung.Aktiv, dbo.Vertragsleistung.Erstellt_am, dbo.Vertragsleistung.Mutiert_am, dbo.Vertragsleistung.Mutierer, dbo.Vertragsleistung.Mandantnr,
|
|
dbo.Vertragsleistung.SecurityLevelNr, dbo.ServiceKatalog.Bezeichnung_intern, dbo.ServiceKatalog.Bezeichnung_extern
|
|
FROM dbo.Vertragsleistung INNER JOIN
|
|
dbo.ServiceKatalog ON dbo.Vertragsleistung.ServicekatalogNr = dbo.ServiceKatalog.ServiceKatalogNr
|
|
where dbo.Vertragsleistung.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and vertragselementnr = @keyvalue
|
|
|
|
ORDER BY
|
|
[vertragsleistungnr] ASC
|
|
end
|
|
|
|
if @fokus=1 begin
|
|
SELECT dbo.Vertragsleistung.VertragsleistungNr, dbo.Vertragsleistung.VertragselementNr, dbo.Vertragsleistung.ServicekatalogNr,
|
|
dbo.Vertragsleistung.Bemerkung, dbo.Vertragsleistung.Aktiv, dbo.Vertragsleistung.Erstellt_am, dbo.Vertragsleistung.Mutiert_am, dbo.Vertragsleistung.Mutierer,
|
|
dbo.Vertragsleistung.Mandantnr, dbo.Vertragsleistung.SecurityLevelNr, dbo.ServiceKatalog.Bezeichnung_intern, dbo.ServiceKatalog.Bezeichnung_extern,
|
|
dbo.Vertragselement.Bezeichnung
|
|
FROM dbo.Vertragsleistung INNER JOIN
|
|
dbo.ServiceKatalog ON dbo.Vertragsleistung.ServicekatalogNr = dbo.ServiceKatalog.ServiceKatalogNr INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragsleistung.VertragselementNr = dbo.Vertragselement.Vertragselementnr
|
|
WHERE (dbo.Vertragsleistung.SecurityLevelNr <= dbo.Get_SecurityLevel(@mitarbeiternr)) AND (dbo.Vertragsleistung.ServicekatalogNr = @keyvalue)
|
|
ORDER BY dbo.Vertragsleistung.Vertragselementnr
|
|
end
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
return
|
|
|
|
-- Nachfolgender Code kann verwendet werden, wenn von einer gewählten Leistung auch die Child-Leistungen angezeigt werden sollen
|
|
--CREATE TABLE #tmpd(
|
|
-- [servicekatalognr] [int] ,
|
|
-- [bezeichnung] [varchar] (255) null,
|
|
-- [parentid] [int] ,
|
|
-- [securitylevelnr] [int],
|
|
--) ON [DEFAULT]
|
|
--
|
|
--Create Table #tmpdata(
|
|
-- [EntryKey] int null,
|
|
-- [EntryText] varchar(50) null,
|
|
-- [VertragsleistungNr] int null,
|
|
-- [VertragselementNr] int null,
|
|
-- [ServicekatalogNr] int null,
|
|
-- [Bemerkung] varchar(255) null,
|
|
-- [Aktiv] bit,
|
|
-- [Erstellt_am] datetime,
|
|
-- [Mutiert_am] datetime,
|
|
-- [Mutierer] int null,
|
|
-- [Mandantnr] int null
|
|
--) ON [DEFAULT]
|
|
--
|
|
--
|
|
--declare @vertragsleistungnr int, @vertragselementnr int, @servicekatalognr int, @bemerkung varchar(255), @aktiv bit, @erstellt_am datetime, @mutiert_am datetime, @mutierer int, @mandantnr int
|
|
--declare @sknr int
|
|
--declare @vnr int
|
|
--declare @bez varchar(255)
|
|
--declare @serviceknr int
|
|
--
|
|
--declare xc cursor for
|
|
-- SELECT dbo.ServiceKatalog.ServiceKatalogNr, dbo.vertragsleistung.vertragsleistungnr
|
|
-- FROM dbo.Vertragsleistung INNER JOIN
|
|
-- dbo.ServiceKatalog ON dbo.Vertragsleistung.ServicekatalogNr = dbo.ServiceKatalog.ServiceKatalogNr
|
|
-- where vertragselementnr = @keyvalue and
|
|
-- dbo.Vertragsleistung.SecurityLevelnr>=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
--open xc
|
|
--fetch next from xc into @sknr, @vnr
|
|
--while @@fetch_status = 0 begin
|
|
-- select @vertragsleistungnr=vertragsleistungnr, @vertragselementnr=vertragselementnr, @servicekatalognr=servicekatalognr,
|
|
-- @bemerkung=bemerkung, @aktiv=aktiv, @erstellt_am=erstellt_am, @mutiert_am=mutiert_am, @mutierer=mutierer, @mandantnr=mandantnr
|
|
-- from dbo.vertragsleistung
|
|
-- where dbo.vertragsleistung.vertragsleistungnr=@vnr
|
|
-- execute dbo.my_servicekatalog_struktur_down @sknr,1
|
|
--
|
|
-- declare xy cursor for select bezeichnung, servicekatalognr from #tmpd order by parentid, bezeichnung
|
|
-- open xy
|
|
-- fetch next from xy into @bez, @serviceknr
|
|
-- while @@fetch_status=0 begin
|
|
-- insert #tmpdata (EntryKey,EntryText,VertragsleistungNr,VertragselementNr,ServicekatalogNr,Bemerkung,Aktiv,Erstellt_am,Mutiert_am,Mutierer,Mandantnr)
|
|
-- values (@sknr, @bez, @vertragsleistungnr,@vertragselementnr,@serviceknr,@bemerkung,@aktiv,@erstellt_am,@mutiert_am,@mutierer,@mandantnr)
|
|
-- fetch next from xy into @bez, @serviceknr
|
|
-- end
|
|
-- close xy
|
|
-- deallocate xy
|
|
-- Truncate table #tmpd
|
|
-- fetch next from xc into @sknr, @vnr
|
|
--end
|
|
--close xc
|
|
--deallocate xc
|
|
--select * from #tmpdata
|
|
--drop table #tmpdata
|
|
--drop table #tmpd
|
|
--return
|
|
|
|
|
|
-- [VertragsleistungNr],
|
|
-- [VertragselementNr],
|
|
-- [ServicekatalogNr],
|
|
-- [Bemerkung],
|
|
-- [Aktiv],
|
|
-- [Erstellt_am],
|
|
-- [Mutiert_am],
|
|
-- [Mutierer],
|
|
-- [Mandantnr]
|
|
|
|
-- SELECT all rows from the table.
|
|
|
|
--SELECT dbo.Vertragsleistung.VertragsleistungNr, dbo.Vertragsleistung.VertragselementNr, dbo.Vertragsleistung.ServicekatalogNr, dbo.Vertragsleistung.Bemerkung,
|
|
-- dbo.Vertragsleistung.Aktiv, dbo.Vertragsleistung.Erstellt_am, dbo.Vertragsleistung.Mutiert_am, dbo.Vertragsleistung.Mutierer, dbo.Vertragsleistung.Mandantnr,
|
|
-- dbo.Vertragsleistung.SecurityLevelNr, dbo.ServiceKatalog.Bezeichnung_intern, dbo.ServiceKatalog.Bezeichnung_extern
|
|
--FROM dbo.Vertragsleistung INNER JOIN
|
|
-- dbo.ServiceKatalog ON dbo.Vertragsleistung.ServicekatalogNr = dbo.ServiceKatalog.ServiceKatalogNr
|
|
--where dbo.Vertragsleistung.SecurityLevelnr>=dbo.Get_SecurityLevel(@mitarbeiternr) and vertragselementnr = @keyvalue
|
|
--
|
|
--ORDER BY
|
|
-- [vertragsleistungnr] ASC
|
|
---- Get the Error Code for the statement just executed.
|
|
--SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsleistung_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Vertragsleistung'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iVertragsleistungNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsleistung_SelectOne]
|
|
@iVertragsleistungNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[VertragsleistungNr],
|
|
[VertragselementNr],
|
|
[ServicekatalogNr],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[SecurityLevelNr]
|
|
FROM [dbo].[Vertragsleistung]
|
|
WHERE
|
|
[VertragsleistungNr] = @iVertragsleistungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragsleistung_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Vertragsleistung'
|
|
-- Gets: @iVertragsleistungNr int
|
|
-- Gets: @iVertragselementNr int
|
|
-- Gets: @iServicekatalogNr int
|
|
-- Gets: @sBemerkung varchar(50)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragsleistung_Update]
|
|
@iVertragsleistungNr int,
|
|
@iVertragselementNr int,
|
|
@iServicekatalogNr int,
|
|
@sBemerkung varchar(50),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iSecurityLevelNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragsleistung]
|
|
SET
|
|
[VertragselementNr] = @iVertragselementNr,
|
|
[ServicekatalogNr] = @iServicekatalogNr,
|
|
[Bemerkung] = @sBemerkung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[SecurityLevelNr] = @iSecurityLevelNr
|
|
WHERE
|
|
[VertragsleistungNr] = @iVertragsleistungNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragspartner_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Vertragspartner'
|
|
-- using the Primary Key.
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragspartner_Delete]
|
|
@iVertragspartnerNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Vertragspartner]
|
|
WHERE
|
|
[VertragspartnerNr] = @iVertragspartnerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragspartner_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Vertragspartner'
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Gets: @sNameZ1 varchar(50)
|
|
-- Gets: @sNameZ2 varchar(50)
|
|
-- Gets: @sStrasse varchar(50)
|
|
-- Gets: @sPostfach varchar(50)
|
|
-- Gets: @sPLZ varchar(50)
|
|
-- Gets: @sOrt varchar(50)
|
|
-- Gets: @sTelefon varchar(50)
|
|
-- Gets: @sTelefax varchar(50)
|
|
-- Gets: @sEMail varchar(50)
|
|
-- Gets: @sInternet varchar(50)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @sSuchbegriffe varchar(1024)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragspartner_Insert]
|
|
@iVertragspartnerNr int,
|
|
@sNameZ1 varchar(50),
|
|
@sNameZ2 varchar(50),
|
|
@sStrasse varchar(50),
|
|
@sPostfach varchar(50),
|
|
@sPLZ varchar(50),
|
|
@sOrt varchar(50),
|
|
@sTelefon varchar(50),
|
|
@sTelefax varchar(50),
|
|
@sEMail varchar(50),
|
|
@sInternet varchar(50),
|
|
@sBemerkung varchar(255),
|
|
@iSecurityLevelNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@sSuchbegriffe varchar(1024),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Vertragspartner]
|
|
(
|
|
[VertragspartnerNr],
|
|
[NameZ1],
|
|
[NameZ2],
|
|
[Strasse],
|
|
[Postfach],
|
|
[PLZ],
|
|
[Ort],
|
|
[Telefon],
|
|
[Telefax],
|
|
[EMail],
|
|
[Internet],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Suchbegriffe]
|
|
)
|
|
VALUES
|
|
(
|
|
@iVertragspartnerNr,
|
|
@sNameZ1,
|
|
@sNameZ2,
|
|
@sStrasse,
|
|
@sPostfach,
|
|
@sPLZ,
|
|
@sOrt,
|
|
@sTelefon,
|
|
@sTelefax,
|
|
@sEMail,
|
|
@sInternet,
|
|
@sBemerkung,
|
|
@iSecurityLevelNr,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr,
|
|
@sSuchbegriffe
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragspartner_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Vertragspartner'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragspartner_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[VertragspartnerNr],
|
|
[NameZ1],
|
|
[NameZ2],
|
|
[Strasse],
|
|
[Postfach],
|
|
[PLZ],
|
|
[Ort],
|
|
[Telefon],
|
|
[Telefax],
|
|
[EMail],
|
|
[Internet],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Suchbegriffe]
|
|
FROM [dbo].[Vertragspartner]
|
|
ORDER BY
|
|
[VertragspartnerNr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragspartner_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Vertragspartner'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragspartner_SelectOne]
|
|
@iVertragspartnerNr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[VertragspartnerNr],
|
|
[NameZ1],
|
|
[NameZ2],
|
|
[Strasse],
|
|
[Postfach],
|
|
[PLZ],
|
|
[Ort],
|
|
[Telefon],
|
|
[Telefax],
|
|
[EMail],
|
|
[Internet],
|
|
[Bemerkung],
|
|
[SecurityLevelNr],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr],
|
|
[Suchbegriffe]
|
|
FROM [dbo].[Vertragspartner]
|
|
WHERE
|
|
[VertragspartnerNr] = @iVertragspartnerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragspartner_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Vertragspartner'
|
|
-- Gets: @iVertragspartnerNr int
|
|
-- Gets: @sNameZ1 varchar(50)
|
|
-- Gets: @sNameZ2 varchar(50)
|
|
-- Gets: @sStrasse varchar(50)
|
|
-- Gets: @sPostfach varchar(50)
|
|
-- Gets: @sPLZ varchar(50)
|
|
-- Gets: @sOrt varchar(50)
|
|
-- Gets: @sTelefon varchar(50)
|
|
-- Gets: @sTelefax varchar(50)
|
|
-- Gets: @sEMail varchar(50)
|
|
-- Gets: @sInternet varchar(50)
|
|
-- Gets: @sBemerkung varchar(255)
|
|
-- Gets: @iSecurityLevelNr int
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Gets: @sSuchbegriffe varchar(1024)
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragspartner_Update]
|
|
@iVertragspartnerNr int,
|
|
@sNameZ1 varchar(50),
|
|
@sNameZ2 varchar(50),
|
|
@sStrasse varchar(50),
|
|
@sPostfach varchar(50),
|
|
@sPLZ varchar(50),
|
|
@sOrt varchar(50),
|
|
@sTelefon varchar(50),
|
|
@sTelefax varchar(50),
|
|
@sEMail varchar(50),
|
|
@sInternet varchar(50),
|
|
@sBemerkung varchar(255),
|
|
@iSecurityLevelNr int,
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@sSuchbegriffe varchar(1024),
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Vertragspartner]
|
|
SET
|
|
[NameZ1] = @sNameZ1,
|
|
[NameZ2] = @sNameZ2,
|
|
[Strasse] = @sStrasse,
|
|
[Postfach] = @sPostfach,
|
|
[PLZ] = @sPLZ,
|
|
[Ort] = @sOrt,
|
|
[Telefon] = @sTelefon,
|
|
[Telefax] = @sTelefax,
|
|
[EMail] = @sEMail,
|
|
[Internet] = @sInternet,
|
|
[Bemerkung] = @sBemerkung,
|
|
[SecurityLevelNr] = @iSecurityLevelNr,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr,
|
|
[Suchbegriffe] = @sSuchbegriffe
|
|
WHERE
|
|
[VertragspartnerNr] = @iVertragspartnerNr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragstyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Vertragstyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iVertragstypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragstyp_Delete]
|
|
@iVertragstypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Vertragstyp]
|
|
WHERE
|
|
[Vertragstypnr] = @iVertragstypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragstyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Vertragstyp'
|
|
-- Gets: @sVertragstyp varchar(50)
|
|
-- Gets: @bAlsLizenz bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iVertragstypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragstyp_Insert]
|
|
@sVertragstyp varchar(50),
|
|
@bAlsLizenz bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@bAktiv bit,
|
|
@iVertragstypnr int OUTPUT,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Vertragstyp]
|
|
(
|
|
[Vertragstyp],
|
|
[AlsLizenz],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
)
|
|
VALUES
|
|
(
|
|
@sVertragstyp,
|
|
@bAlsLizenz,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@bAktiv
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
-- Get the IDENTITY value for the row just inserted.
|
|
SELECT @iVertragstypnr=SCOPE_IDENTITY()
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragstyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Vertragstyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragstyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Vertragstypnr],
|
|
[Vertragstyp],
|
|
[AlsLizenz],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Vertragstyp]
|
|
ORDER BY
|
|
[Vertragstypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragstyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Vertragstyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iVertragstypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragstyp_SelectOne]
|
|
@iVertragstypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Vertragstypnr],
|
|
[Vertragstyp],
|
|
[AlsLizenz],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Aktiv]
|
|
FROM [dbo].[Vertragstyp]
|
|
WHERE
|
|
[Vertragstypnr] = @iVertragstypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Vertragstyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Vertragstyp'
|
|
-- Gets: @iVertragstypnr int
|
|
-- Gets: @sVertragstyp varchar(50)
|
|
-- Gets: @bAlsLizenz bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @bAktiv bit
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Vertragstyp_Update]
|
|
@iVertragstypnr int,
|
|
@sVertragstyp varchar(50),
|
|
@bAlsLizenz bit,
|
|
@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].[Vertragstyp]
|
|
SET
|
|
[Vertragstyp] = @sVertragstyp,
|
|
[AlsLizenz] = @bAlsLizenz,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Aktiv] = @bAktiv
|
|
WHERE
|
|
[Vertragstypnr] = @iVertragstypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Zeiteinheittyp_Delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will delete an existing row from the table 'Zeiteinheittyp'
|
|
-- using the Primary Key.
|
|
-- Gets: @iZeiteinheittypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Zeiteinheittyp_Delete]
|
|
@iZeiteinheittypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- DELETE an existing row from the table.
|
|
DELETE FROM [dbo].[Zeiteinheittyp]
|
|
WHERE
|
|
[Zeiteinheittypnr] = @iZeiteinheittypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Zeiteinheittyp_Insert] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will insert 1 row in the table 'Zeiteinheittyp'
|
|
-- Gets: @iZeiteinheittypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Zeiteinheittyp_Insert]
|
|
@iZeiteinheittypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- INSERT a new row in the table.
|
|
INSERT [dbo].[Zeiteinheittyp]
|
|
(
|
|
[Zeiteinheittypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
)
|
|
VALUES
|
|
(
|
|
@iZeiteinheittypnr,
|
|
@sBezeichnung,
|
|
@sBeschreibung,
|
|
@bAktiv,
|
|
@daErstellt_am,
|
|
@daMutiert_am,
|
|
@iMutierer,
|
|
@iMandantnr
|
|
)
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Zeiteinheittyp_SelectAll] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Zeiteinheittyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Zeiteinheittyp_SelectAll]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Zeiteinheittypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Zeiteinheittyp]
|
|
ORDER BY
|
|
[Zeiteinheittypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Zeiteinheittyp_SelectAll_Aktive] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Zeiteinheittyp'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Zeiteinheittyp_SelectAll_Aktive]
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Zeiteinheittypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Zeiteinheittyp]
|
|
where aktiv=1
|
|
ORDER BY
|
|
[Zeiteinheittypnr] ASC
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Zeiteinheittyp_SelectOne] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select an existing row from the table 'Zeiteinheittyp'
|
|
-- based on the Primary Key.
|
|
-- Gets: @iZeiteinheittypnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Zeiteinheittyp_SelectOne]
|
|
@iZeiteinheittypnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT an existing row from the table.
|
|
SELECT
|
|
[Zeiteinheittypnr],
|
|
[Bezeichnung],
|
|
[Beschreibung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer],
|
|
[Mandantnr]
|
|
FROM [dbo].[Zeiteinheittyp]
|
|
WHERE
|
|
[Zeiteinheittypnr] = @iZeiteinheittypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[pr_Zeiteinheittyp_Update] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will update an existing row in the table 'Zeiteinheittyp'
|
|
-- Gets: @iZeiteinheittypnr int
|
|
-- Gets: @sBezeichnung varchar(50)
|
|
-- Gets: @sBeschreibung varchar(255)
|
|
-- Gets: @bAktiv bit
|
|
-- Gets: @daErstellt_am datetime
|
|
-- Gets: @daMutiert_am datetime
|
|
-- Gets: @iMutierer int
|
|
-- Gets: @iMandantnr int
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[pr_Zeiteinheittyp_Update]
|
|
@iZeiteinheittypnr int,
|
|
@sBezeichnung varchar(50),
|
|
@sBeschreibung varchar(255),
|
|
@bAktiv bit,
|
|
@daErstellt_am datetime,
|
|
@daMutiert_am datetime,
|
|
@iMutierer int,
|
|
@iMandantnr int,
|
|
@iErrorCode int OUTPUT
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- UPDATE an existing row in the table.
|
|
UPDATE [dbo].[Zeiteinheittyp]
|
|
SET
|
|
[Bezeichnung] = @sBezeichnung,
|
|
[Beschreibung] = @sBeschreibung,
|
|
[Aktiv] = @bAktiv,
|
|
[Erstellt_am] = @daErstellt_am,
|
|
[Mutiert_am] = @daMutiert_am,
|
|
[Mutierer] = @iMutierer,
|
|
[Mandantnr] = @iMandantnr
|
|
WHERE
|
|
[Zeiteinheittypnr] = @iZeiteinheittypnr
|
|
-- Get the Error Code for the statement just executed.
|
|
SELECT @iErrorCode=@@ERROR
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[refresh_txp_kpi_data] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: Ruedi Schwarzenbach
|
|
-- Create date: 23.02.2016
|
|
-- Description: KPI Pillars aus TXP Datenbank importieren und aufbereiten
|
|
-- Design Documentation: "P:\SER\IT\IT-Betrieb\50_Produkte\TicketXpert\Changes
|
|
-- \AT_00044 - Monatlicher Datentransfer ins ITSM\Analyse und Design.docx"
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[refresh_txp_kpi_data]
|
|
AS
|
|
BEGIN
|
|
-- SET NOCOUNT ON added to prevent extra result sets from
|
|
-- interfering with SELECT statements.
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @preconditions_ok INT = 0
|
|
EXEC dbo.check_txp_kpi_data_refresh_preconditions @result = @preconditions_ok OUTPUT
|
|
|
|
IF @preconditions_ok <> 0
|
|
BEGIN
|
|
IF OBJECT_ID('dbo.____SHU_LVer_IN_AU', 'U') IS NOT NULL DROP TABLE dbo.____SHU_LVer_IN_AU;
|
|
IF OBJECT_ID('dbo.____SHU_Ticketdata', 'U') IS NOT NULL DROP TABLE dbo.____SHU_Ticketdata;
|
|
IF OBJECT_ID('dbo.____SHU_Ticketdata_AU', 'U') IS NOT NULL DROP TABLE dbo.____SHU_Ticketdata_AU;
|
|
IF OBJECT_ID('dbo.____SHU_TicketData_IN', 'U') IS NOT NULL DROP TABLE dbo.____SHU_TicketData_IN;
|
|
IF OBJECT_ID('dbo.shu_view_an_excelexport_lst', 'U') IS NOT NULL DROP TABLE dbo.shu_view_an_excelexport_lst;
|
|
|
|
SELECT * INTO dbo.____SHU_LVer_IN_AU FROM TXP.dbo.____SHU_LVer_IN_AU_TBL;
|
|
SELECT * INTO dbo.____SHU_Ticketdata FROM TXP.dbo.____SHU_Ticketdata_TBL;
|
|
SELECT * INTO dbo.____SHU_Ticketdata_AU FROM TXP.dbo.____SHU_Ticketdata_AU_TBL;
|
|
SELECT * INTO dbo.____SHU_TicketData_IN FROM TXP.dbo.____SHU_TicketData_IN_TBL;
|
|
SELECT * INTO dbo.shu_view_an_excelexport_lst FROM TXP.dbo.shu_view_an_excelexport_lst_TBL;
|
|
|
|
EXEC dbo.mig_txp_data
|
|
END
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[rpt_ikv_berechtigung] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[rpt_ikv_berechtigung]
|
|
AS
|
|
BEGIN
|
|
|
|
SELECT distinct
|
|
[tgnummer]
|
|
,[name]
|
|
,[vorname]
|
|
,'Leseberechtigung' as Typ
|
|
into #tmp1
|
|
FROM [Vertragsverwaltung].[dbo].[View_IKV_Berechtigungseinschraenkung]
|
|
where readonly=1 and invisible=0
|
|
order by name
|
|
|
|
insert #tmp1
|
|
SELECT distinct TOP 1000
|
|
[tgnummer]
|
|
,[name]
|
|
,[vorname]
|
|
,'Keine Rechte' as Typ
|
|
FROM [Vertragsverwaltung].[dbo].[View_IKV_Berechtigungseinschraenkung]
|
|
where readonly=1 and invisible=1
|
|
order by name
|
|
|
|
insert #tmp1
|
|
SELECT distinct TOP 1000
|
|
[tgnummer]
|
|
,[name]
|
|
,[vorname]
|
|
,'Keine Rechte' as Typ
|
|
FROM [Vertragsverwaltung].[dbo].[View_IKV_Berechtigungseinschraenkung]
|
|
where readonly=0 and invisible=1
|
|
order by name
|
|
|
|
insert #tmp1
|
|
select tgnummer, name, vorname ,'Update Rechte' from mitarbeiter where tgnummer not in (select tgnummer from #tmp1)
|
|
|
|
select * from #tmp1 order by name, vorname
|
|
drop table #tmp1
|
|
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[set_refresh_txp_kpi_data_status] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: Ruedi Schwarzenbach
|
|
-- Create date: 26.02.2016
|
|
-- Description: selbstredend
|
|
-- Design Documentation: "P:\SER\IT\IT-Betrieb\50_Produkte\TicketXpert\Changes
|
|
-- \AT_00044 - Monatlicher Datentransfer ins ITSM\Analyse und Design.docx"
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[set_refresh_txp_kpi_data_status]
|
|
@status VARCHAR(MAX)
|
|
AS
|
|
BEGIN
|
|
-- SET NOCOUNT ON added to prevent extra result sets from
|
|
-- interfering with SELECT statements.
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @preconditions_ok INT = 0
|
|
EXEC dbo.check_txp_kpi_data_refresh_preconditions @result = @preconditions_ok OUTPUT
|
|
|
|
|
|
IF @preconditions_ok <> 0
|
|
BEGIN
|
|
UPDATE TXP.dbo._tkb_refresh_kpi_data_time SET status_itsm = @status WHERE zeitpunkt = CAST( GETDATE() AS DATE)
|
|
END
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_applikation_get_vertragselemente] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: Stefan Hutter
|
|
-- Create date: 21.01.2009
|
|
-- Description: Gibt die Lizenzvertragselemente einer Applikation zurück
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_applikation_get_vertragselemente]
|
|
@applikationnr int,
|
|
@mitarbeiternr int
|
|
as
|
|
SET NOCOUNT ON;
|
|
|
|
SELECT DISTINCT
|
|
dbo.Applikation.ApplikationNr, dbo.Vertragselement.Vertragselementnr, dbo.Vertragstyp.Vertragstyp,
|
|
dbo.Vertragselement.Bezeichnung + ' / ' + dbo.Vertragspartner.NameZ1 + ', ' + dbo.Vertragspartner.Ort AS Vertragselement, dbo.Vertragselement.Aktiv,
|
|
dbo.Vertragselement.Erstellt_am, dbo.Vertragselement.Mutiert_am, dbo.Vertragselement.Mutierer, dbo.Vertragselement.SecurityLevelNr,
|
|
dbo.VertragselementApplikation.Vertragselementapplikationnr, dbo.VertragselementApplikation.ApplikationVersionNr, dbo.ApplikationVersion.Version
|
|
--dbo.Lizenzkauf.LizenzkaufNr
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Applikation INNER JOIN
|
|
dbo.Vertragstyp INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragstyp.Vertragstypnr = dbo.Vertragselement.VertragstypNr INNER JOIN
|
|
dbo.VertragselementApplikation ON dbo.Vertragselement.Vertragselementnr = dbo.VertragselementApplikation.Vertragselementnr ON
|
|
dbo.Applikation.ApplikationNr = dbo.VertragselementApplikation.Applikationnr ON
|
|
dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr LEFT OUTER JOIN
|
|
dbo.Lizenzkauf ON dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.Lizenzkauf.Vertragselementapplikationnr LEFT OUTER JOIN
|
|
dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr
|
|
WHERE (dbo.Vertragselement.SecurityLevelNr <= dbo.Get_SecurityLevel(@mitarbeiternr)) AND (dbo.vertragselementapplikation.Applikationnr = @applikationnr) AND (dbo.VertragselementApplikation.Aktiv = 1) AND
|
|
(dbo.Lizenzkauf.Aktiv = 1)
|
|
|
|
|
|
--SELECT DISTINCT
|
|
-- dbo.Applikation.ApplikationNr, dbo.Vertragselement.Vertragselementnr, dbo.Vertragstyp.Vertragstyp,
|
|
-- dbo.Vertragselement.Bezeichnung + ' / ' + dbo.Vertragspartner.NameZ1 + ', ' + dbo.Vertragspartner.Ort AS Vertragselement, dbo.Vertragselement.Aktiv,
|
|
-- dbo.Vertragselement.Erstellt_am, dbo.Vertragselement.Mutiert_am, dbo.Vertragselement.Mutierer, dbo.Vertragselement.SecurityLevelNr,
|
|
-- dbo.VertragselementApplikation.Vertragselementnr AS Expr1, dbo.VertragselementApplikation.ApplikationVersionNr, dbo.ApplikationVersion.Version
|
|
--FROM dbo.Vertragstyp INNER JOIN
|
|
-- dbo.Vertragselement ON dbo.Vertragstyp.Vertragstypnr = dbo.Vertragselement.VertragstypNr INNER JOIN
|
|
-- dbo.VertragselementApplikation ON dbo.Vertragselement.Vertragselementnr = dbo.VertragselementApplikation.Vertragselementnr INNER JOIN
|
|
-- dbo.Applikation INNER JOIN
|
|
-- dbo.Lizenzkauf ON dbo.Applikation.ApplikationNr = dbo.Lizenzkauf.ApplikationNr ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr AND
|
|
-- dbo.VertragselementApplikation.Vertragselementnr = dbo.Lizenzkauf.Vertragselementnr INNER JOIN
|
|
-- dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr LEFT OUTER JOIN
|
|
-- dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr
|
|
|
|
--WHERE (dbo.Vertragselement.SecurityLevelNr <= dbo.Get_SecurityLevel(1)) AND (dbo.Lizenzkauf.ApplikationNr = @applikationnr) AND (dbo.VertragselementApplikation.Aktiv = @mitarbeiternr) AND
|
|
-- (dbo.Lizenzkauf.Aktiv = 1)
|
|
|
|
|
|
--SELECT dbo.Applikation.ApplikationNr, dbo.Vertragselement.Vertragselementnr, dbo.Vertragstyp.Vertragstyp, dbo.Lizenztyp.Bezeichnung AS Lizenztyp,
|
|
-- dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Vertragselement.Aktiv, dbo.Vertragselement.Erstellt_am, dbo.Vertragselement.Mutiert_am,
|
|
-- dbo.Vertragselement.Mutierer, dbo.Vertragselement.SecurityLevelNr
|
|
--FROM dbo.Vertragselement INNER JOIN
|
|
-- dbo.Applikation ON dbo.Vertragselement.ApplikationNr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
-- dbo.Lizenztyp ON dbo.Vertragselement.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr INNER JOIN
|
|
-- dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
--where dbo.vertragselement.applikationnr=@applikationnr and dbo.vertragselement.securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_applikationsuebersicht_get_details] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <13.01.2008>
|
|
-- Description: <Auslesen der Struktur (inkl. Kategorien) der Applikationsverwaltung>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_applikationsuebersicht_get_details]
|
|
@entryroot int,
|
|
@suchstring as varchar(255),
|
|
@mitarbeiternr int
|
|
AS
|
|
CREATE TABLE #tmpd(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
-- [applikationskategorienr] [int],
|
|
[aktiv] [bit] null,
|
|
) ON [DEFAULT]
|
|
|
|
-- Rootentry für die Treeaufbereitung in der Applikation
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
|
|
declare @appnr int
|
|
declare @appbez varchar(50)
|
|
declare @appprnt int
|
|
declare @anr int
|
|
declare @bez varchar(50)
|
|
declare @pid int
|
|
declare @aktiv bit
|
|
|
|
set @appprnt = -1
|
|
-----------------------------------------------------------------------------------------
|
|
-- Erster Loop über die Applikationkategorie
|
|
-----------------------------------------------------------------------------------------
|
|
if @entryroot < 0 begin
|
|
set @entryroot=@entryroot * -1
|
|
declare xc cursor for
|
|
select ApplikationKategorieNr, bezeichnung, aktiv from dbo.applikationkategorie where aktiv=1 and applikationkategorienr=@entryroot
|
|
open xc
|
|
fetch next from xc into @appnr, @appbez, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, aktiv)
|
|
values (@appprnt, @appbez, 0,1)
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Zweiter Loop über die Einträge der obesten Ebene der Applikationen
|
|
-----------------------------------------------------------------------------------------
|
|
declare yc cursor for
|
|
select applikationnr, bezeichnung, parentid, @aktiv from applikation
|
|
where applikationkategorienr=@appnr and parentid=0
|
|
open yc
|
|
fetch next from yc into @anr, @bez, @pid, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, aktiv)
|
|
values (@anr, @bez, @appprnt, @aktiv)
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Je Applikation die untergeordneten Applikationen/Module auslesen
|
|
-----------------------------------------------------------------------------------------
|
|
execute dbo.sp_get_applstruktur_down @anr,1, @anr
|
|
|
|
fetch next from yc into @anr, @bez, @pid, @aktiv
|
|
end
|
|
close yc
|
|
deallocate yc
|
|
|
|
set @appprnt = @appprnt - 1
|
|
fetch next from xc into @appnr, @appbez, @aktiv
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
end else begin
|
|
declare yc1 cursor for
|
|
select applikationnr, bezeichnung, parentid, @aktiv from applikation
|
|
where applikationnr=@entryroot
|
|
open yc1
|
|
fetch next from yc1 into @anr, @bez, @pid, @aktiv
|
|
while @@fetch_status=0 begin
|
|
print @anr
|
|
print @bez
|
|
print '----'
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, aktiv)
|
|
values (@anr, @bez, @appprnt, @aktiv)
|
|
-----------------------------------------------------------------------------------------
|
|
-- Je Applikation die untergeordneten Applikationen/Module auslesen
|
|
-----------------------------------------------------------------------------------------
|
|
execute dbo.sp_get_applstruktur_down @anr,1, @anr
|
|
fetch next from yc1 into @anr, @bez, @pid, @aktiv
|
|
end
|
|
close yc1
|
|
deallocate yc1
|
|
end
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Daten zurück geben und temporäre Tabelle löschen
|
|
-----------------------------------------------------------------------------------------
|
|
delete from #tmpd where parentid is null
|
|
|
|
|
|
--> Ohne Suchstring
|
|
if @suchstring='' begin
|
|
SELECT distinct dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation.ParentID, dbo.Applikation.ApplikationVerantwortungNr,
|
|
dbo.Applikation.ApplikationKategorieNr, dbo.Applikation.ApplikationTeamNr, dbo.Applikation.Marktbereichnr, dbo.Applikation.Version, dbo.Applikation.AlsProdukt,
|
|
dbo.Applikation.NurLizenz, dbo.Applikation.PrioWiederanlauf, dbo.Applikation.Kurzbeschreibung, dbo.Applikation.Inaktivseit, dbo.Applikation.RAS,
|
|
dbo.Applikation.Datenbankname, dbo.Applikation.Anzahl_Installationen, dbo.Applikation.Test_Aufwand, dbo.Applikation.Test_Arbeitsplaetze,
|
|
dbo.Applikation.Test_Abhaengigkeiten, dbo.Applikation.Test_Bemerkung, dbo.Applikation.TicketXPertVerwendung, dbo.Applikation.TicketXPert_WPIAnzeigen,
|
|
dbo.Applikation.TicketXPert_Preis, dbo.Applikation.TicketXPert_Preis_Einmalig, dbo.Applikation.TicketXPert_AMAnzeigen,
|
|
dbo.Applikation.TicketXPert_ApplikationKritikalitaetTypNr, dbo.Applikation.TicketXPert_ApplikationSMLTypNr, dbo.Applikation.Aktiv, dbo.Applikation.Erstellt_am,
|
|
dbo.Applikation.Mutiert_am, dbo.Applikation.Mutierer, dbo.Applikation.SecurityLevelNr, dbo.Applikation.RfcBoardNr, dbo.GremiumGruppierung.GremiumGruppierungNr,
|
|
dbo.GremiumGruppierung.GremiumNr, dbo.GremiumGruppierung.Gruppierungsbegriff, dbo.GremiumGruppierung.Beschreibung,
|
|
dbo.GremiumGruppierung.Reihenfolge, dbo.GremiumGruppierung.Aktiv AS Expr1, dbo.GremiumGruppierung.Erstellt_am AS Expr2,
|
|
dbo.GremiumGruppierung.Mutiert_am AS Expr3, dbo.GremiumGruppierung.Mutierer AS Expr4, GremiumBereich_1.GremiumBereichNr,
|
|
GremiumBereich_1.GremiumGruppierungNr AS Expr5, GremiumBereich_1.Bereich, GremiumBereich_1.Beschreibung AS Expr6, GremiumBereich_1.Sortierung,
|
|
GremiumBereich_1.Aktiv AS Expr7, GremiumBereich_1.Erstellt_am AS Expr8, GremiumBereich_1.Mutiert_am AS Expr9, GremiumBereich_1.Mutierer AS Expr10,
|
|
GremiumGruppierung_1.GremiumGruppierungNr AS Expr11, GremiumGruppierung_1.GremiumNr AS Expr12, GremiumGruppierung_1.Gruppierungsbegriff AS Expr13,
|
|
GremiumGruppierung_1.Beschreibung AS Expr14, GremiumGruppierung_1.Reihenfolge AS Expr15, GremiumGruppierung_1.Aktiv AS Expr16,
|
|
GremiumGruppierung_1.Erstellt_am AS Expr17, GremiumGruppierung_1.Mutiert_am AS Expr18, GremiumGruppierung_1.Mutierer AS Expr19,
|
|
dbo.GremiumGruppierung.Gruppierungsbegriff AS Marktbereich, GremiumBereich_1.Bereich AS Team, GremiumGruppierung_1.Gruppierungsbegriff AS Verantwortung,
|
|
dbo.GremiumBereich.Bereich AS RFCBoard
|
|
FROM dbo.Applikation INNER JOIN
|
|
#tmpd on #tmpd.applikationsnr = dbo.applikation.applikationnr LEFT OUTER JOIN
|
|
dbo.GremiumBereich ON dbo.Applikation.RfcBoardNr = dbo.GremiumBereich.GremiumBereichNr LEFT OUTER JOIN
|
|
dbo.GremiumBereich AS GremiumBereich_1 ON dbo.Applikation.ApplikationTeamNr = GremiumBereich_1.GremiumBereichNr LEFT OUTER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Applikation.Marktbereichnr = dbo.GremiumGruppierung.GremiumGruppierungNr LEFT OUTER JOIN
|
|
dbo.GremiumGruppierung AS GremiumGruppierung_1 ON dbo.Applikation.ApplikationVerantwortungNr = GremiumGruppierung_1.GremiumGruppierungNr
|
|
where dbo.applikation.securitylevelnr<=dbo.get_securitylevel(@mitarbeiternr)
|
|
order by dbo.applikation.parentid, dbo.applikation.bezeichnung
|
|
|
|
|
|
--SELECT DISTINCT
|
|
-- dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation.ParentID, dbo.Applikation.ApplikationVerantwortungNr,
|
|
-- dbo.ApplikationVerantwortung.Bezeichnung AS Verantwortung, dbo.Applikation.ApplikationKategorieNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie,
|
|
-- dbo.Applikation.Marktbereichnr, dbo.Marktbereich.Bezeichnung AS Marktbereich, dbo.Applikation.Version, dbo.Applikation.AlsProdukt, dbo.Applikation.NurLizenz,
|
|
-- dbo.Applikation.PrioWiederanlauf, dbo.Applikation.Kurzbeschreibung, dbo.Applikation.Inaktivseit, dbo.Applikation.RAS, dbo.Applikation.Datenbankname,
|
|
-- dbo.Applikation.Anzahl_Installationen, dbo.Applikation.Test_Aufwand, dbo.Applikation.Test_Arbeitsplaetze, dbo.Applikation.Test_Abhaengigkeiten,
|
|
-- dbo.Applikation.Test_Bemerkung, dbo.Applikation.TicketXPertVerwendung, dbo.Applikation.TicketXPert_WPIAnzeigen, dbo.Applikation.TicketXPert_Preis,
|
|
-- dbo.Applikation.TicketXPert_Preis_Einmalig, dbo.Applikation.TicketXPert_AMAnzeigen, dbo.Applikation.TicketXPert_ApplikationKritikalitaetTypNr,
|
|
-- dbo.Applikation.TicketXPert_ApplikationSMLTypNr, dbo.ApplikationSLMTyp.Bezeichnung AS SML, dbo.Applikation.Aktiv, dbo.Applikation.Erstellt_am,
|
|
-- dbo.Applikation.Mutiert_am, dbo.Applikation.Mutierer, dbo.Applikation.SecurityLevelNr, dbo.applikationteam.bezeichnung as Team
|
|
--FROM dbo.Applikation INNER JOIN
|
|
-- #tmpd on #tmpd.applikationsnr = dbo.applikation.applikationnr inner join
|
|
-- dbo.ApplikationVerantwortung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.ApplikationVerantwortung.ApplikationVerantwortungNr INNER JOIN
|
|
-- dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN
|
|
-- dbo.Marktbereich ON dbo.Applikation.Marktbereichnr = dbo.Marktbereich.MarktbereichNr LEFT OUTER JOIN
|
|
-- dbo.ApplikationSLMTyp ON dbo.Applikation.TicketXPert_ApplikationSMLTypNr = dbo.ApplikationSLMTyp.ApplikationSLMTypNr LEFT OUTER JOIN
|
|
-- dbo.ApplikationTeam ON dbo.Applikation.ApplikationTeamNr = dbo.ApplikationTeam.ApplikationTeamNr
|
|
--where dbo.applikation.securitylevelnr<=dbo.get_securitylevel(@mitarbeiternr)
|
|
--order by dbo.applikation.parentid, dbo.applikation.bezeichnung
|
|
--end else begin
|
|
--> Mit Suchstring
|
|
end else begin
|
|
set @suchstring='%' + @suchstring + '%'
|
|
SELECT distinct dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation.ParentID, dbo.Applikation.ApplikationVerantwortungNr,
|
|
dbo.Applikation.ApplikationKategorieNr, dbo.Applikation.ApplikationTeamNr, dbo.Applikation.Marktbereichnr, dbo.Applikation.Version, dbo.Applikation.AlsProdukt,
|
|
dbo.Applikation.NurLizenz, dbo.Applikation.PrioWiederanlauf, dbo.Applikation.Kurzbeschreibung, dbo.Applikation.Inaktivseit, dbo.Applikation.RAS,
|
|
dbo.Applikation.Datenbankname, dbo.Applikation.Anzahl_Installationen, dbo.Applikation.Test_Aufwand, dbo.Applikation.Test_Arbeitsplaetze,
|
|
dbo.Applikation.Test_Abhaengigkeiten, dbo.Applikation.Test_Bemerkung, dbo.Applikation.TicketXPertVerwendung, dbo.Applikation.TicketXPert_WPIAnzeigen,
|
|
dbo.Applikation.TicketXPert_Preis, dbo.Applikation.TicketXPert_Preis_Einmalig, dbo.Applikation.TicketXPert_AMAnzeigen,
|
|
dbo.Applikation.TicketXPert_ApplikationKritikalitaetTypNr, dbo.Applikation.TicketXPert_ApplikationSMLTypNr, dbo.Applikation.Aktiv, dbo.Applikation.Erstellt_am,
|
|
dbo.Applikation.Mutiert_am, dbo.Applikation.Mutierer, dbo.Applikation.SecurityLevelNr, dbo.Applikation.RfcBoardNr, dbo.GremiumGruppierung.GremiumGruppierungNr,
|
|
dbo.GremiumGruppierung.GremiumNr, dbo.GremiumGruppierung.Gruppierungsbegriff, dbo.GremiumGruppierung.Beschreibung,
|
|
dbo.GremiumGruppierung.Reihenfolge, dbo.GremiumGruppierung.Aktiv AS Expr1, dbo.GremiumGruppierung.Erstellt_am AS Expr2,
|
|
dbo.GremiumGruppierung.Mutiert_am AS Expr3, dbo.GremiumGruppierung.Mutierer AS Expr4, GremiumBereich_1.GremiumBereichNr,
|
|
GremiumBereich_1.GremiumGruppierungNr AS Expr5, GremiumBereich_1.Bereich, GremiumBereich_1.Beschreibung AS Expr6, GremiumBereich_1.Sortierung,
|
|
GremiumBereich_1.Aktiv AS Expr7, GremiumBereich_1.Erstellt_am AS Expr8, GremiumBereich_1.Mutiert_am AS Expr9, GremiumBereich_1.Mutierer AS Expr10,
|
|
GremiumGruppierung_1.GremiumGruppierungNr AS Expr11, GremiumGruppierung_1.GremiumNr AS Expr12, GremiumGruppierung_1.Gruppierungsbegriff AS Expr13,
|
|
GremiumGruppierung_1.Beschreibung AS Expr14, GremiumGruppierung_1.Reihenfolge AS Expr15, GremiumGruppierung_1.Aktiv AS Expr16,
|
|
GremiumGruppierung_1.Erstellt_am AS Expr17, GremiumGruppierung_1.Mutiert_am AS Expr18, GremiumGruppierung_1.Mutierer AS Expr19,
|
|
dbo.GremiumGruppierung.Gruppierungsbegriff AS Marktbereich, GremiumBereich_1.Bereich AS Team, GremiumGruppierung_1.Gruppierungsbegriff AS Verantwortung,
|
|
dbo.GremiumBereich.Bereich AS RFCBoard
|
|
FROM dbo.Applikation INNER JOIN
|
|
#tmpd on #tmpd.applikationsnr = dbo.applikation.applikationnr inner join
|
|
dbo.ApplikationKontakt ON dbo.Applikation.ApplikationNr = dbo.ApplikationKontakt.Applikationnr INNER JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr LEFT OUTER JOIN
|
|
dbo.GremiumBereich ON dbo.Applikation.RfcBoardNr = dbo.GremiumBereich.GremiumBereichNr LEFT OUTER JOIN
|
|
dbo.GremiumBereich AS GremiumBereich_1 ON dbo.Applikation.ApplikationTeamNr = GremiumBereich_1.GremiumBereichNr LEFT OUTER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Applikation.Marktbereichnr = dbo.GremiumGruppierung.GremiumGruppierungNr LEFT OUTER JOIN
|
|
dbo.GremiumGruppierung AS GremiumGruppierung_1 ON dbo.Applikation.ApplikationVerantwortungNr = GremiumGruppierung_1.GremiumGruppierungNr
|
|
where dbo.applikation.securitylevelnr<=dbo.get_securitylevel(@mitarbeiternr) and
|
|
(dbo.Applikation.bezeichnung like @suchstring or dbo.Applikation.kurzbeschreibung like @suchstring or dbo.person.name like @suchstring or dbo.person.vorname like @suchstring)
|
|
order by dbo.applikation.parentid, dbo.applikation.bezeichnung
|
|
|
|
--SELECT DISTINCT
|
|
-- dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation.ParentID, dbo.Applikation.ApplikationVerantwortungNr,
|
|
-- dbo.ApplikationVerantwortung.Bezeichnung AS Verantwortung, dbo.Applikation.ApplikationKategorieNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie,
|
|
-- dbo.Applikation.Marktbereichnr, dbo.Marktbereich.Bezeichnung AS Marktbereich, dbo.Applikation.Version, dbo.Applikation.AlsProdukt, dbo.Applikation.NurLizenz,
|
|
-- dbo.Applikation.PrioWiederanlauf, dbo.Applikation.Kurzbeschreibung, dbo.Applikation.Inaktivseit, dbo.Applikation.RAS, dbo.Applikation.Datenbankname,
|
|
-- dbo.Applikation.Anzahl_Installationen, dbo.Applikation.Test_Aufwand, dbo.Applikation.Test_Arbeitsplaetze, dbo.Applikation.Test_Abhaengigkeiten,
|
|
-- dbo.Applikation.Test_Bemerkung, dbo.Applikation.TicketXPertVerwendung, dbo.Applikation.TicketXPert_WPIAnzeigen, dbo.Applikation.TicketXPert_Preis,
|
|
-- dbo.Applikation.TicketXPert_Preis_Einmalig, dbo.Applikation.TicketXPert_AMAnzeigen, dbo.Applikation.TicketXPert_ApplikationKritikalitaetTypNr,
|
|
-- dbo.Applikation.TicketXPert_ApplikationSMLTypNr, dbo.ApplikationSLMTyp.Bezeichnung AS SML, dbo.Applikation.Aktiv, dbo.Applikation.Erstellt_am,
|
|
-- dbo.Applikation.Mutiert_am, dbo.Applikation.Mutierer, dbo.Applikation.SecurityLevelNr, dbo.applikationteam.bezeichnung as Team
|
|
--FROM dbo.Applikation INNER JOIN
|
|
-- #tmpd on #tmpd.applikationsnr = dbo.applikation.applikationnr inner join
|
|
-- dbo.ApplikationVerantwortung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.ApplikationVerantwortung.ApplikationVerantwortungNr INNER JOIN
|
|
-- dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN
|
|
-- dbo.Marktbereich ON dbo.Applikation.Marktbereichnr = dbo.Marktbereich.MarktbereichNr LEFT OUTER JOIN
|
|
-- dbo.ApplikationSLMTyp ON dbo.Applikation.TicketXPert_ApplikationSMLTypNr = dbo.ApplikationSLMTyp.ApplikationSLMTypNr LEFT OUTER JOIN
|
|
-- dbo.ApplikationTeam ON dbo.Applikation.ApplikationTeamNr = dbo.ApplikationTeam.ApplikationTeamNr
|
|
--where dbo.applikation.securitylevelnr<=dbo.get_securitylevel(@mitarbeiternr) and
|
|
-- (dbo.Applikation.bezeichnung like @suchstring or dbo.Applikation.kurzbeschreibung like @suchstring)
|
|
--order by dbo.applikation.parentid, dbo.applikation.bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_architektur_crosstab] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_architektur_crosstab]
|
|
@type int,
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TmpCrosstabResult]') AND type in (N'U')) DROP TABLE [dbo].[TmpCrosstabResult]
|
|
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TmpCrosstabResult1]') AND type in (N'U')) DROP TABLE [dbo].[TmpCrosstabResult1]
|
|
|
|
declare @xsql varchar(8000)
|
|
|
|
CREATE TABLE [dbo].[TmpCrosstabResult](
|
|
[KeyValue] [int] NULL
|
|
) ON [Default]
|
|
|
|
create Table #tmp1(
|
|
[Applikation] [Varchar] (255) null,
|
|
[Col] [varchar] (255) null,
|
|
[colid] int null
|
|
)
|
|
|
|
if @type=1 begin
|
|
set @xsql='SELECT DISTINCT Bezeichnung AS Applikation, REPLACE(Datenbank,'+ CHAR(39)+' ' + char(39)+', '+CHAR(39)+'_'+CHAR(39)+') AS Col, 0 as ColID FROM dbo.View_Applikation_Server '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
insert into #tmp1 exec(@xsql)
|
|
end
|
|
if @type=2 begin
|
|
set @xsql='SELECT DISTINCT Bezeichnung AS Applikation, REPLACE(Datenbank,'+ CHAR(39)+' ' + char(39)+', '+CHAR(39)+'_'+CHAR(39)+') AS Col, 0 as ColID FROM dbo.View_Applikation_Sst '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
insert into #tmp1 exec(@xsql)
|
|
end
|
|
if @type=3 begin
|
|
set @xsql='SELECT DISTINCT Bezeichnung AS Applikation, REPLACE(Datenbank,'+ CHAR(39)+' ' + char(39)+', '+CHAR(39)+'_'+CHAR(39)+') AS Col, 0 as ColID FROM dbo.View_Applikation_Datenbank '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
insert into #tmp1 exec(@xsql)
|
|
end
|
|
|
|
|
|
declare @col varchar(255)
|
|
declare @cnt int
|
|
set @cnt=0
|
|
declare xc cursor for
|
|
select distinct col from #tmp1
|
|
open xc
|
|
fetch next from xc into @col
|
|
while @@FETCH_STATUS=0 begin
|
|
update #tmp1 set colid=@cnt where COL=@col
|
|
set @cnt=@cnt+1
|
|
fetch next from xc into @col
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
exec sys_crosstab #tmp1, 'colid','col','Col',1,'Applikation', @CalcOperation='max',@debug=0,@TempTableName='TmpCrosstabResult'
|
|
|
|
|
|
CREATE TABLE [dbo].[TmpCrosstabResult1](
|
|
[KeyValue] [int] NULL,
|
|
[Applikation] [varchar] (255) null
|
|
) ON [Default]
|
|
|
|
declare @column varchar(255)
|
|
set @xsql = ''
|
|
set @cnt=0
|
|
declare xx cursor for
|
|
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TmpCrosstabResult' and column_name <> 'KeyValue' and column_name <> 'Applikation'
|
|
open xx
|
|
fetch next from xx into @column
|
|
while @@FETCH_STATUS=0 begin
|
|
set @xsql = 'alter table dbo.tmpcrosstabresult1 add ['+@column+'] varchar(1) null'
|
|
exec(@xsql)
|
|
fetch next from xx into @column
|
|
end
|
|
close xx
|
|
deallocate xx
|
|
|
|
|
|
insert into TmpCrosstabResult1 select * from TmpCrosstabResult
|
|
exec('alter table tmpcrosstabresult1 drop column keyvalue')
|
|
|
|
declare xx cursor for
|
|
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TmpCrosstabResult1' and column_name <> 'Applikation'
|
|
open xx
|
|
fetch next from xx into @column
|
|
while @@FETCH_STATUS=0 begin
|
|
set @xsql = 'update tmpcrosstabresult1 set ['+@column+']='+char(39)+'X'+char(39) +' where ['+@column+'] <> '+char(39)+'0'+char(39)
|
|
exec(@xsql)
|
|
set @xsql = 'update tmpcrosstabresult1 set ['+@column+']='+char(39)+''+char(39) +' where ['+@column+'] = '+char(39)+'0'+char(39)
|
|
exec(@xsql)
|
|
fetch next from xx into @column
|
|
end
|
|
close xx
|
|
deallocate xx
|
|
|
|
select * from TmpCrosstabResult1
|
|
drop table tmpcrosstabresult
|
|
drop table tmpcrosstabresult1
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_architektur_crosstab_datenbank] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_architektur_crosstab_datenbank]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
exec dbo.sp_architektur_crosstab 3,@sqlwhere
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_architektur_crosstab_server] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_architektur_crosstab_server]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
exec dbo.sp_architektur_crosstab 1,@sqlwhere
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_architektur_crosstab_sst] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_architektur_crosstab_sst]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
exec dbo.sp_architektur_crosstab 2,@sqlwhere
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_Auswertung_Get_Auswertungen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE proc [dbo].[sp_Auswertung_Get_Auswertungen]
|
|
@mitarbeiternr int
|
|
as
|
|
CREATE TABLE #tmpd(
|
|
|
|
[ID] [int] ,
|
|
|
|
[bezeichnung] [varchar] (255) null,
|
|
|
|
[parentid] [int] null,
|
|
|
|
[Auswertungnr] [int],
|
|
|
|
[beschreibung] [varchar] (1024) null
|
|
|
|
) ON [DEFAULT]
|
|
|
|
|
|
|
|
declare @id int
|
|
|
|
declare @gnr int
|
|
|
|
declare @anr int
|
|
|
|
declare @bez varchar(255)
|
|
|
|
declare @pid int
|
|
|
|
declare @gnr1 int
|
|
|
|
declare @gbez varchar(255)
|
|
|
|
declare @cnt int
|
|
|
|
declare @besch varchar(1024)
|
|
|
|
set @id=1000
|
|
|
|
declare xc cursor for
|
|
|
|
SELECT DISTINCT dbo.auswertunggruppeauswertung.auswertunggruppenr as auswertunggruppenr, dbo.auswertung.auswertungnr,
|
|
|
|
dbo.auswertung.bezeichnung as auswertung, dbo.auswertung.beschreibung
|
|
|
|
FROM dbo.AuswertungGruppe INNER JOIN
|
|
|
|
dbo.funktionsgruppe_auswertungGruppe ON dbo.AuswertungGruppe.AuswertungGruppeNr = dbo.funktionsgruppe_auswertungGruppe.AuswertungGruppeNr INNER JOIN
|
|
|
|
dbo.funktionsgruppe ON dbo.funktionsgruppe_auswertungGruppe.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
|
|
dbo.mitarbeiter_funktionsgruppe ON dbo.funktionsgruppe.funktionsgruppenr = dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
|
|
dbo.AuswertungGruppeAuswertung ON dbo.AuswertungGruppe.AuswertungGruppeNr = dbo.AuswertungGruppeAuswertung.AuswertungGruppeNr INNER JOIN
|
|
|
|
dbo.Auswertung ON dbo.AuswertungGruppeAuswertung.AuswertungNr = dbo.Auswertung.AuswertungNr
|
|
|
|
WHERE (dbo.AuswertungGruppe.Aktiv = 1) AND (dbo.funktionsgruppe_auswertungGruppe.Aktiv = 1) AND (dbo.funktionsgruppe.aktiv = 1) AND
|
|
|
|
(dbo.mitarbeiter_funktionsgruppe.aktiv = 1) AND (dbo.AuswertungGruppeAuswertung.Aktiv = 1) AND (dbo.Auswertung.Aktiv = 1) AND
|
|
|
|
(dbo.mitarbeiter_funktionsgruppe.mitarbeiternr = @mitarbeiternr)
|
|
|
|
open xc
|
|
|
|
fetch next from xc into @gnr, @anr, @bez, @besch
|
|
|
|
while @@fetch_status=0 begin
|
|
|
|
set @id=@id+1
|
|
|
|
insert #tmpd(id, bezeichnung, parentid, auswertungnr, beschreibung) values (@id, @bez, @gnr, @anr, @besch)
|
|
|
|
|
|
|
|
set @pid=@gnr
|
|
|
|
while @pid>0 begin
|
|
|
|
select @gnr1=auswertunggruppenr, @gbez=bezeichnung, @pid=parentid from auswertunggruppe where auswertunggruppenr=@gnr
|
|
|
|
select @cnt=count(*) from #tmpd where id=@gnr1
|
|
|
|
if @cnt=0 insert #tmpd(id, bezeichnung, parentid, auswertungnr, beschreibung) values (@gnr1,@gbez,@pid,0,'')
|
|
|
|
set @gnr=@pid
|
|
|
|
end
|
|
|
|
fetch next from xc into @gnr, @anr, @bez, @besch
|
|
|
|
end
|
|
|
|
close xc
|
|
|
|
deallocate xc
|
|
|
|
insert #tmpd (id, bezeichnung, parentid, auswertungnr, beschreibung) values (0, 'root',null,null,null)
|
|
|
|
select * from #tmpd order by bezeichnung
|
|
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_Check_Lizenzen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzkauf'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[sp_Check_Lizenzen]
|
|
@Vertragselementapplikationnr int,
|
|
@anzahl int output
|
|
AS
|
|
SET NOCOUNT ON
|
|
select @anzahl=COUNT(*)
|
|
FROM dbo.LizenzVertragselementApplikation where VertragselementApplikationNr=@vertragselementapplikationnr and Aktiv=1
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_Check_lizenzkauf] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzkauf'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[sp_Check_lizenzkauf]
|
|
@Vertragselementnr int,
|
|
@fnkt varchar(255),
|
|
@mitarbeiternr int,
|
|
@anzahl int output
|
|
AS
|
|
SET NOCOUNT ON
|
|
if @fnkt='Get' begin
|
|
select @anzahl=COUNT(*)
|
|
FROM dbo.Lizenzkauf INNER JOIN
|
|
dbo.VertragselementApplikation ON dbo.Lizenzkauf.Vertragselementapplikationnr = dbo.VertragselementApplikation.VertragselementApplikationnr
|
|
WHERE (dbo.VertragselementApplikation.Vertragselementnr = @vertragselementnr) AND (dbo.Lizenzkauf.Aktiv = 1) AND (dbo.VertragselementApplikation.Aktiv = 1)
|
|
end
|
|
if @fnkt='Get1' begin
|
|
select @anzahl=COUNT(*)
|
|
FROM dbo.Lizenzkauf where vertragselementapplikationnr = @vertragselementnr and aktiv = 1
|
|
end
|
|
if @fnkt='Del' begin
|
|
update dbo.lizenzkauf set aktiv=0, mutiert_am = getdate(), mutierer=@mitarbeiternr where vertragselementapplikationnr=@vertragselementnr
|
|
set @anzahl=0
|
|
end
|
|
--SELECT @anzahl=COUNT(*)
|
|
--FROM dbo.Lizenzkauf INNER JOIN
|
|
-- dbo.VertragselementApplikation ON dbo.Lizenzkauf.Vertragselementnr = dbo.VertragselementApplikation.Vertragselementnr AND
|
|
-- dbo.Lizenzkauf.ApplikationNr = dbo.VertragselementApplikation.Applikationnr
|
|
--WHERE (dbo.Lizenzkauf.Vertragselementnr = @Vertragselementnr) AND (dbo.Lizenzkauf.Aktiv = 1) AND (dbo.VertragselementApplikation.Aktiv = 1)
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_check_veappl] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_check_veappl]
|
|
@venr int,
|
|
@applnr int,
|
|
@versionnr int,
|
|
@counter int output
|
|
AS
|
|
BEGIN
|
|
select @counter=COUNT(*) from VertragselementApplikation where Vertragselementnr=@venr and applikationnr=@applnr and applikationversionnr=@versionnr
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_check_version] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_check_version]
|
|
@versionnr int,
|
|
@returnvalue int output
|
|
AS
|
|
BEGIN
|
|
declare @rc int
|
|
select @rc=COUNT(*) from dbo.VertragselementApplikation where ApplikationVersionNr=@versionnr and Aktiv=1
|
|
print @rc
|
|
if @rc>0 begin
|
|
set @returnvalue=1
|
|
return
|
|
end
|
|
set @returnvalue=0
|
|
return
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_copy_securityObjects] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_copy_securityObjects]
|
|
@source int,
|
|
@dest int,
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
declare @newkey int
|
|
declare @ec int
|
|
declare @rsnr int
|
|
select * into #tmpa from rolle_securityobject where rollenr=@source and aktiv=1
|
|
declare xc cursor for
|
|
select rolle_securityobjectnr from #tmpa
|
|
open xc
|
|
fetch next from xc into @rsnr
|
|
while @@fetch_status=0 begin
|
|
execute sp_get_dbkey 'Rolle_SecurityObject', @newkey output, @ec output
|
|
update #tmpa set rolle_securityobjectnr = @newkey where rolle_securityobjectnr=@rsnr
|
|
fetch next from xc into @rsnr
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
update #tmpa set rollenr=@dest, erstellt_am=getdate(), mutiert_am=getdate(), mutierer=@mitarbeiternr
|
|
insert rolle_securityobject select * from #tmpa
|
|
drop table #tmpa
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_generate_activity] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: Stefan Hutter
|
|
-- Create date: 29.01.2009
|
|
-- Description: Aktivitäten aus Ereignissen generieren
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_generate_activity]
|
|
@mitarbeiternr int=0,
|
|
@datum varchar(20)=''
|
|
as
|
|
|
|
declare @steuerdatum datetime
|
|
declare @tmp varchar(50)
|
|
IF @datum='' begin
|
|
--select @steuerdatum=convert(varchar(10),getdate(),104)
|
|
select @steuerdatum =getdate()
|
|
print @steuerdatum
|
|
end else begin
|
|
select @steuerdatum=@datum
|
|
print @steuerdatum
|
|
end
|
|
insert joblog (logentry) values (@steuerdatum)
|
|
--------------------------------------------------------------------
|
|
-- Vertragsablauf
|
|
--------------------------------------------------------------------
|
|
declare @vdate datetime
|
|
set @vdate = FLOOR( CAST( @steuerdatum AS FLOAT ) )
|
|
|
|
Insert into Aktivitaet
|
|
SELECT 0 as EreignisNr, 1 AS AktivitaetStatusNr, 15, @steuerdatum AS Ausgeloest_am,
|
|
'Vertragsstatus prüfen' AS Ereignis, '' AS Kostenart, 0,
|
|
@steuerdatum as Termin,'' as Beschreibung, '' as Bemerkung,
|
|
0 as SecurityLevelNr, 1 AS aktiv, GETDATE() AS erstellt_am, GETDATE() AS mutiert_am, 9999 AS mutierer,
|
|
'' as Kuendigungsfrist, Vertragselement.Vertragselementnr as vertragselementnr
|
|
from dbo.vertragselement
|
|
where vertragselement.aktiv=1 and dbo.vertragselement.vertragsablauf = @vdate
|
|
|
|
--------------------------------------------------------------------
|
|
-- Gekündigt per
|
|
--------------------------------------------------------------------
|
|
|
|
Insert into Aktivitaet
|
|
SELECT 0 as EreignisNr, 1 AS AktivitaetStatusNr, 15, @steuerdatum AS Ausgeloest_am,
|
|
'Vertragsstatus prüfen' AS Ereignis, '' AS Kostenart, 0,
|
|
@steuerdatum as Termin,'' as Beschreibung, '' as Bemerkung,
|
|
0 as SecurityLevelNr, 1 AS aktiv, GETDATE() AS erstellt_am, GETDATE() AS mutiert_am, 9999 AS mutierer,
|
|
'' as Kuendigungsfrist, Vertragselement.Vertragselementnr as vertragselementnr
|
|
from dbo.vertragselement
|
|
where vertragselement.aktiv=1 and dateadd(d,1,dbo.vertragselement.Gekuendigt_per) = @vdate
|
|
|
|
|
|
|
|
--------------------------------------------------------------------
|
|
-- Einmalige Ereignisse
|
|
--------------------------------------------------------------------
|
|
insert into aktivitaet
|
|
|
|
SELECT dbo.Vertragsereignis.EreignisNr, 1 AS AktivitaetStatusNr, dbo.Periodizitaet.PeriodizitaetNr, @steuerdatum AS Ausgeloest_am,
|
|
dbo.Ereignistyp.Bezeichnung AS Ereignis, dbo.Kostenart.Bezeichnung AS Kostenart, dbo.Vertragsereignis.Betrag,
|
|
|
|
dbo.check_generate_activity(dbo.vertragsereignis.datum, dbo.vertragsereignis.datum,@steuerdatum,
|
|
dbo.vertragsereignis.vorlaufzeit,dbo.vertragsereignis.periodizitaetnr,
|
|
dbo.Ereignistyp.Aktivitaeten_generieren, dbo.vertragsereignis.kuendigungsfristnr,dbo.ereignistyp.kuendigung,1,1) as Termin,
|
|
dbo.Vertragsereignis.Bezeichnung AS Beschreibung, dbo.Vertragsereignis.Beschreibung AS Bemerkung,
|
|
dbo.Vertragsereignis.SecurityLevelNr, 1 AS aktiv, GETDATE() AS erstellt_am, GETDATE() AS mutiert_am, 9999 AS mutierer,
|
|
dbo.get_kuendigungsfrist(dbo.vertragsereignis.kuendigungsfristnr,dbo.ereignistyp.kuendigung) as Kuendigungsfrist,0 as vertragselementnr
|
|
FROM dbo.Vertragsereignis INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Vertragsereignis.PeriodizitaetNr = dbo.Periodizitaet.PeriodizitaetNr INNER JOIN
|
|
dbo.Ereignistyp ON dbo.Vertragsereignis.EreignistypNr = dbo.Ereignistyp.Ereignistypnr INNER JOIN
|
|
dbo.Kostenart ON dbo.Vertragsereignis.KostenartNr = dbo.Kostenart.KostenartNr
|
|
WHERE dbo.Ereignistyp.Aktivitaeten_generieren = 1 and dbo.vertragsereignis.aktiv=1
|
|
--and
|
|
and dbo.check_generate_activity(dbo.vertragsereignis.Datum, dbo.vertragsereignis.datum,@steuerdatum,
|
|
dbo.vertragsereignis.vorlaufzeit,dbo.vertragsereignis.periodizitaetnr,
|
|
dbo.Ereignistyp.Aktivitaeten_generieren, dbo.vertragsereignis.kuendigungsfristnr,dbo.ereignistyp.kuendigung,0,1)='1'
|
|
and dbo.vertragsereignis.periodizitaetnr=15
|
|
|
|
|
|
--------------------------------------------------------------------
|
|
-- Periodische
|
|
--------------------------------------------------------------------
|
|
|
|
Insert into aktivitaet
|
|
SELECT dbo.Vertragsereignis.EreignisNr, 1 AS AktivitaetStatusNr, dbo.Periodizitaet.PeriodizitaetNr, @steuerdatum AS Ausgeloest_am,
|
|
dbo.Ereignistyp.Bezeichnung AS Ereignis, dbo.Kostenart.Bezeichnung AS Kostenart, dbo.Vertragsereignis.Betrag,
|
|
dbo.check_generate_activity(dbo.vertragsereignis.start, dbo.vertragsereignis.ende,@steuerdatum,
|
|
dbo.vertragsereignis.vorlaufzeit,dbo.vertragsereignis.periodizitaetnr,
|
|
dbo.Ereignistyp.Aktivitaeten_generieren, dbo.vertragsereignis.kuendigungsfristnr,dbo.ereignistyp.kuendigung,1,0) as Termin,
|
|
--'' as termin,
|
|
dbo.Vertragsereignis.Bezeichnung AS Beschreibung, dbo.Vertragsereignis.Beschreibung AS Bemerkung,
|
|
dbo.Vertragsereignis.SecurityLevelNr, 1 AS aktiv, GETDATE() AS erstellt_am, GETDATE() AS mutiert_am, 9999 AS mutierer,
|
|
dbo.get_kuendigungsfrist(dbo.vertragsereignis.kuendigungsfristnr,dbo.ereignistyp.kuendigung) as Kuendigungsfrist, 0 as vertragselementnr
|
|
FROM dbo.Vertragsereignis INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Vertragsereignis.PeriodizitaetNr = dbo.Periodizitaet.PeriodizitaetNr INNER JOIN
|
|
dbo.Ereignistyp ON dbo.Vertragsereignis.EreignistypNr = dbo.Ereignistyp.Ereignistypnr INNER JOIN
|
|
dbo.Kostenart ON dbo.Vertragsereignis.KostenartNr = dbo.Kostenart.KostenartNr
|
|
WHERE dbo.vertragsereignis.periodizitaetnr<>15 and dbo.vertragsereignis.periodizitaetnr<>0 and
|
|
dbo.check_generate_activity(dbo.vertragsereignis.start, dbo.vertragsereignis.ende,@steuerdatum,
|
|
dbo.vertragsereignis.vorlaufzeit,dbo.vertragsereignis.periodizitaetnr,
|
|
dbo.Ereignistyp.Aktivitaeten_generieren, dbo.vertragsereignis.kuendigungsfristnr,dbo.ereignistyp.kuendigung,0,0)='1'
|
|
and dbo.vertragsereignis.aktiv=1
|
|
|
|
insert joblog (logentry) values ('ende')
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_generate_activity_test] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_generate_activity_test]
|
|
@startdatum datetime,
|
|
@enddatum datetime,
|
|
@steuerdatum datetime,
|
|
@vorlauf int,
|
|
@periode int,
|
|
@Set_Activity int=0 output
|
|
|
|
as
|
|
declare @workdate datetime
|
|
---------------------------------------------------------------------------------------------------------------------------
|
|
--Vorlaufzeit in Tagen vom Startdatum abziehen. Wenn dieses nach dem aktuellen Tagesdatum liegt, keine Aktivität generieren
|
|
---------------------------------------------------------------------------------------------------------------------------
|
|
set @startdatum=dateadd(dd,@vorlauf*-1,@startdatum)
|
|
if @startdatum > @steuerdatum begin
|
|
set @set_activity = 0
|
|
return
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------
|
|
-- Berechnung
|
|
-- 1=einmalig,2=täglich,3=wöchentlich,4=monatlich,5=zwei-monatlich,6=vierteljährlich,7=halbjährlich,8=jählrich
|
|
---------------------------------------------------------------------------------------------------------------------------
|
|
set @workdate=@startdatum
|
|
while @workdate < @enddatum begin
|
|
print @workdate
|
|
if @workdate=@steuerdatum begin
|
|
set @Set_Activity=1
|
|
print 'to select'
|
|
return
|
|
end
|
|
if @workdate > @steuerdatum begin
|
|
set @Set_Activity=0
|
|
print 'no select'
|
|
return
|
|
end
|
|
|
|
if @periode = 2 set @workdate=dateadd(dd,1,@workdate)
|
|
if @periode = 3 set @workdate=dateadd(ww,1,@workdate)
|
|
if @periode = 4 set @workdate=dateadd(mm,1,@workdate)
|
|
if @periode = 5 set @workdate=dateadd(mm,2,@workdate)
|
|
if @periode = 6 set @workdate=dateadd(qq,1,@workdate)
|
|
if @periode = 7 set @workdate=dateadd(qq,2,@workdate)
|
|
if @periode = 8 set @workdate=dateadd(yy,1,@workdate)
|
|
end
|
|
|
|
set @Set_Activity=0
|
|
print 'no selection'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_generate_inserts] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE PROC [dbo].[sp_generate_inserts]
|
|
(
|
|
@table_name varchar(776), -- The table/view for which the INSERT statements will be generated using the existing data
|
|
@target_table varchar(776) = NULL, -- Use this parameter to specify a different table name into which the data will be inserted
|
|
@include_column_list bit = 1, -- Use this parameter to include/ommit column list in the generated INSERT statement
|
|
@from varchar(800) = NULL, -- Use this parameter to filter the rows based on a filter condition (using WHERE)
|
|
@include_timestamp bit = 0, -- Specify 1 for this parameter, if you want to include the TIMESTAMP/ROWVERSION column's data in the INSERT statement
|
|
@debug_mode bit = 0, -- If @debug_mode is set to 1, the SQL statements constructed by this procedure will be printed for later examination
|
|
@owner varchar(64) = NULL, -- Use this parameter if you are not the owner of the table
|
|
@ommit_images bit = 0, -- Use this parameter to generate INSERT statements by omitting the 'image' columns
|
|
@ommit_identity bit = 0, -- Use this parameter to ommit the identity columns
|
|
@top int = NULL, -- Use this parameter to generate INSERT statements only for the TOP n rows
|
|
@cols_to_include varchar(8000) = NULL, -- List of columns to be included in the INSERT statement
|
|
@cols_to_exclude varchar(8000) = NULL, -- List of columns to be excluded from the INSERT statement
|
|
@disable_constraints bit = 0, -- When 1, disables foreign key constraints and enables them after the INSERT statements
|
|
@ommit_computed_cols bit = 0 -- When 1, computed columns will not be included in the INSERT statement
|
|
|
|
)
|
|
AS
|
|
BEGIN
|
|
|
|
/***********************************************************************************************************
|
|
Procedure: sp_generate_inserts (Build 22)
|
|
(Copyright © 2002 Narayana Vyas Kondreddi. All rights reserved.)
|
|
|
|
Purpose: To generate INSERT statements from existing data.
|
|
These INSERTS can be executed to regenerate the data at some other location.
|
|
This procedure is also useful to create a database setup, where in you can
|
|
script your data along with your table definitions.
|
|
|
|
Written by: Narayana Vyas Kondreddi
|
|
http://vyaskn.tripod.com
|
|
|
|
Acknowledgements:
|
|
Divya Kalra -- For beta testing
|
|
Mark Charsley -- For reporting a problem with scripting uniqueidentifier columns with NULL values
|
|
Artur Zeygman -- For helping me simplify a bit of code for handling non-dbo owned tables
|
|
Joris Laperre -- For reporting a regression bug in handling text/ntext columns
|
|
|
|
Tested on: SQL Server 7.0 and SQL Server 2000
|
|
|
|
Date created: January 17th 2001 21:52 GMT
|
|
|
|
Date modified: May 1st 2002 19:50 GMT
|
|
|
|
Email: vyaskn@hotmail.com
|
|
|
|
NOTE: This procedure may not work with tables with too many columns.
|
|
Results can be unpredictable with huge text columns or SQL Server 2000's sql_variant data types
|
|
Whenever possible, Use @include_column_list parameter to ommit column list in the INSERT statement, for better results
|
|
IMPORTANT: This procedure is not tested with internation data (Extended characters or Unicode). If needed
|
|
you might want to convert the datatypes of character variables in this procedure to their respective unicode counterparts
|
|
like nchar and nvarchar
|
|
|
|
|
|
Example 1: To generate INSERT statements for table 'titles':
|
|
|
|
EXEC sp_generate_inserts 'titles'
|
|
|
|
Example 2: To ommit the column list in the INSERT statement: (Column list is included by default)
|
|
IMPORTANT: If you have too many columns, you are advised to ommit column list, as shown below,
|
|
to avoid erroneous results
|
|
|
|
EXEC sp_generate_inserts 'titles', @include_column_list = 0
|
|
|
|
Example 3: To generate INSERT statements for 'titlesCopy' table from 'titles' table:
|
|
|
|
EXEC sp_generate_inserts 'titles', 'titlesCopy'
|
|
|
|
Example 4: To generate INSERT statements for 'titles' table for only those titles
|
|
which contain the word 'Computer' in them:
|
|
NOTE: Do not complicate the FROM or WHERE clause here. It's assumed that you are good with T-SQL if you are using this parameter
|
|
|
|
EXEC sp_generate_inserts 'titles', @from = "from titles where title like '%Computer%'"
|
|
|
|
Example 5: To specify that you want to include TIMESTAMP column's data as well in the INSERT statement:
|
|
(By default TIMESTAMP column's data is not scripted)
|
|
|
|
EXEC sp_generate_inserts 'titles', @include_timestamp = 1
|
|
|
|
Example 6: To print the debug information:
|
|
|
|
EXEC sp_generate_inserts 'titles', @debug_mode = 1
|
|
|
|
Example 7: If you are not the owner of the table, use @owner parameter to specify the owner name
|
|
To use this option, you must have SELECT permissions on that table
|
|
|
|
EXEC sp_generate_inserts Nickstable, @owner = 'Nick'
|
|
|
|
Example 8: To generate INSERT statements for the rest of the columns excluding images
|
|
When using this otion, DO NOT set @include_column_list parameter to 0.
|
|
|
|
EXEC sp_generate_inserts imgtable, @ommit_images = 1
|
|
|
|
Example 9: To generate INSERT statements excluding (ommiting) IDENTITY columns:
|
|
(By default IDENTITY columns are included in the INSERT statement)
|
|
|
|
EXEC sp_generate_inserts mytable, @ommit_identity = 1
|
|
|
|
Example 10: To generate INSERT statements for the TOP 10 rows in the table:
|
|
|
|
EXEC sp_generate_inserts mytable, @top = 10
|
|
|
|
Example 11: To generate INSERT statements with only those columns you want:
|
|
|
|
EXEC sp_generate_inserts titles, @cols_to_include = "'title','title_id','au_id'"
|
|
|
|
Example 12: To generate INSERT statements by omitting certain columns:
|
|
|
|
EXEC sp_generate_inserts titles, @cols_to_exclude = "'title','title_id','au_id'"
|
|
|
|
Example 13: To avoid checking the foreign key constraints while loading data with INSERT statements:
|
|
|
|
EXEC sp_generate_inserts titles, @disable_constraints = 1
|
|
|
|
Example 14: To exclude computed columns from the INSERT statement:
|
|
EXEC sp_generate_inserts MyTable, @ommit_computed_cols = 1
|
|
***********************************************************************************************************/
|
|
|
|
SET NOCOUNT ON
|
|
|
|
--Making sure user only uses either @cols_to_include or @cols_to_exclude
|
|
IF ((@cols_to_include IS NOT NULL) AND (@cols_to_exclude IS NOT NULL))
|
|
BEGIN
|
|
RAISERROR('Use either @cols_to_include or @cols_to_exclude. Do not use both the parameters at once',16,1)
|
|
RETURN -1 --Failure. Reason: Both @cols_to_include and @cols_to_exclude parameters are specified
|
|
END
|
|
|
|
--Making sure the @cols_to_include and @cols_to_exclude parameters are receiving values in proper format
|
|
IF ((@cols_to_include IS NOT NULL) AND (PATINDEX('''%''',@cols_to_include) = 0))
|
|
BEGIN
|
|
RAISERROR('Invalid use of @cols_to_include property',16,1)
|
|
PRINT 'Specify column names surrounded by single quotes and separated by commas'
|
|
PRINT 'Eg: EXEC sp_generate_inserts titles, @cols_to_include = "''title_id'',''title''"'
|
|
RETURN -1 --Failure. Reason: Invalid use of @cols_to_include property
|
|
END
|
|
|
|
IF ((@cols_to_exclude IS NOT NULL) AND (PATINDEX('''%''',@cols_to_exclude) = 0))
|
|
BEGIN
|
|
RAISERROR('Invalid use of @cols_to_exclude property',16,1)
|
|
PRINT 'Specify column names surrounded by single quotes and separated by commas'
|
|
PRINT 'Eg: EXEC sp_generate_inserts titles, @cols_to_exclude = "''title_id'',''title''"'
|
|
RETURN -1 --Failure. Reason: Invalid use of @cols_to_exclude property
|
|
END
|
|
|
|
|
|
--Checking to see if the database name is specified along wih the table name
|
|
--Your database context should be local to the table for which you want to generate INSERT statements
|
|
--specifying the database name is not allowed
|
|
IF (PARSENAME(@table_name,3)) IS NOT NULL
|
|
BEGIN
|
|
RAISERROR('Do not specify the database name. Be in the required database and just specify the table name.',16,1)
|
|
RETURN -1 --Failure. Reason: Database name is specified along with the table name, which is not allowed
|
|
END
|
|
|
|
--Checking for the existence of 'user table' or 'view'
|
|
--This procedure is not written to work on system tables
|
|
--To script the data in system tables, just create a view on the system tables and script the view instead
|
|
|
|
IF @owner IS NULL
|
|
BEGIN
|
|
IF ((OBJECT_ID(@table_name,'U') IS NULL) AND (OBJECT_ID(@table_name,'V') IS NULL))
|
|
BEGIN
|
|
RAISERROR('User table or view not found.',16,1)
|
|
PRINT 'You may see this error, if you are not the owner of this table or view. In that case use @owner parameter to specify the owner name.'
|
|
PRINT 'Make sure you have SELECT permission on that table or view.'
|
|
RETURN -1 --Failure. Reason: There is no user table or view with this name
|
|
END
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @table_name AND (TABLE_TYPE = 'BASE TABLE' OR TABLE_TYPE = 'VIEW') AND TABLE_SCHEMA = @owner)
|
|
BEGIN
|
|
RAISERROR('User table or view not found.',16,1)
|
|
PRINT 'You may see this error, if you are not the owner of this table. In that case use @owner parameter to specify the owner name.'
|
|
PRINT 'Make sure you have SELECT permission on that table or view.'
|
|
RETURN -1 --Failure. Reason: There is no user table or view with this name
|
|
END
|
|
END
|
|
|
|
--Variable declarations
|
|
DECLARE @Column_ID int,
|
|
@Column_List varchar(8000),
|
|
@Column_Name varchar(128),
|
|
@Start_Insert varchar(786),
|
|
@Data_Type varchar(128),
|
|
@Actual_Values varchar(8000), --This is the string that will be finally executed to generate INSERT statements
|
|
@IDN varchar(128) --Will contain the IDENTITY column's name in the table
|
|
|
|
--Variable Initialization
|
|
SET @IDN = ''
|
|
SET @Column_ID = 0
|
|
SET @Column_Name = ''
|
|
SET @Column_List = ''
|
|
SET @Actual_Values = ''
|
|
|
|
IF @owner IS NULL
|
|
BEGIN
|
|
SET @Start_Insert = 'INSERT INTO ' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']'
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @Start_Insert = 'INSERT ' + '[' + LTRIM(RTRIM(@owner)) + '].' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']'
|
|
END
|
|
|
|
|
|
--To get the first column's ID
|
|
|
|
SELECT @Column_ID = MIN(ORDINAL_POSITION)
|
|
FROM INFORMATION_SCHEMA.COLUMNS (NOLOCK)
|
|
WHERE TABLE_NAME = @table_name AND
|
|
(@owner IS NULL OR TABLE_SCHEMA = @owner)
|
|
|
|
|
|
|
|
--Loop through all the columns of the table, to get the column names and their data types
|
|
WHILE @Column_ID IS NOT NULL
|
|
BEGIN
|
|
SELECT @Column_Name = QUOTENAME(COLUMN_NAME),
|
|
@Data_Type = DATA_TYPE
|
|
FROM INFORMATION_SCHEMA.COLUMNS (NOLOCK)
|
|
WHERE ORDINAL_POSITION = @Column_ID AND
|
|
TABLE_NAME = @table_name AND
|
|
(@owner IS NULL OR TABLE_SCHEMA = @owner)
|
|
|
|
|
|
|
|
IF @cols_to_include IS NOT NULL --Selecting only user specified columns
|
|
BEGIN
|
|
IF CHARINDEX( '''' + SUBSTRING(@Column_Name,2,LEN(@Column_Name)-2) + '''',@cols_to_include) = 0
|
|
BEGIN
|
|
GOTO SKIP_LOOP
|
|
END
|
|
END
|
|
|
|
IF @cols_to_exclude IS NOT NULL --Selecting only user specified columns
|
|
BEGIN
|
|
IF CHARINDEX( '''' + SUBSTRING(@Column_Name,2,LEN(@Column_Name)-2) + '''',@cols_to_exclude) <> 0
|
|
BEGIN
|
|
GOTO SKIP_LOOP
|
|
END
|
|
END
|
|
|
|
--Making sure to output SET IDENTITY_INSERT ON/OFF in case the table has an IDENTITY column
|
|
IF (SELECT COLUMNPROPERTY( OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name),SUBSTRING(@Column_Name,2,LEN(@Column_Name) - 2),'IsIdentity')) = 1
|
|
BEGIN
|
|
IF @ommit_identity = 0 --Determing whether to include or exclude the IDENTITY column
|
|
SET @IDN = @Column_Name
|
|
ELSE
|
|
GOTO SKIP_LOOP
|
|
END
|
|
|
|
--Making sure whether to output computed columns or not
|
|
IF @ommit_computed_cols = 1
|
|
BEGIN
|
|
IF (SELECT COLUMNPROPERTY( OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name),SUBSTRING(@Column_Name,2,LEN(@Column_Name) - 2),'IsComputed')) = 1
|
|
BEGIN
|
|
GOTO SKIP_LOOP
|
|
END
|
|
END
|
|
|
|
--Tables with columns of IMAGE data type are not supported for obvious reasons
|
|
IF(@Data_Type in ('image'))
|
|
BEGIN
|
|
IF (@ommit_images = 0)
|
|
BEGIN
|
|
RAISERROR('Tables with image columns are not supported.',16,1)
|
|
PRINT 'Use @ommit_images = 1 parameter to generate INSERTs for the rest of the columns.'
|
|
PRINT 'DO NOT ommit Column List in the INSERT statements. If you ommit column list using @include_column_list=0, the generated INSERTs will fail.'
|
|
RETURN -1 --Failure. Reason: There is a column with image data type
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
GOTO SKIP_LOOP
|
|
END
|
|
END
|
|
|
|
--Determining the data type of the column and depending on the data type, the VALUES part of
|
|
--the INSERT statement is generated. Care is taken to handle columns with NULL values. Also
|
|
--making sure, not to lose any data from flot, real, money, smallmomey, datetime columns
|
|
SET @Actual_Values = @Actual_Values +
|
|
CASE
|
|
WHEN @Data_Type IN ('char','varchar','nchar','nvarchar')
|
|
THEN
|
|
'COALESCE('''''''' + REPLACE(RTRIM(' + @Column_Name + '),'''''''','''''''''''')+'''''''',''NULL'')'
|
|
WHEN @Data_Type IN ('datetime','smalldatetime')
|
|
THEN
|
|
'COALESCE('''''''' + RTRIM(CONVERT(char,' + @Column_Name + ',109))+'''''''',''NULL'')'
|
|
WHEN @Data_Type IN ('uniqueidentifier')
|
|
THEN
|
|
'COALESCE('''''''' + REPLACE(CONVERT(char(255),RTRIM(' + @Column_Name + ')),'''''''','''''''''''')+'''''''',''NULL'')'
|
|
WHEN @Data_Type IN ('text','ntext')
|
|
THEN
|
|
'COALESCE('''''''' + REPLACE(CONVERT(char(8000),' + @Column_Name + '),'''''''','''''''''''')+'''''''',''NULL'')'
|
|
WHEN @Data_Type IN ('binary','varbinary')
|
|
THEN
|
|
'COALESCE(RTRIM(CONVERT(char,' + 'CONVERT(int,' + @Column_Name + '))),''NULL'')'
|
|
WHEN @Data_Type IN ('timestamp','rowversion')
|
|
THEN
|
|
CASE
|
|
WHEN @include_timestamp = 0
|
|
THEN
|
|
'''DEFAULT'''
|
|
ELSE
|
|
'COALESCE(RTRIM(CONVERT(char,' + 'CONVERT(int,' + @Column_Name + '))),''NULL'')'
|
|
END
|
|
WHEN @Data_Type IN ('float','real','money','smallmoney')
|
|
THEN
|
|
'COALESCE(LTRIM(RTRIM(' + 'CONVERT(char, ' + @Column_Name + ',2)' + ')),''NULL'')'
|
|
ELSE
|
|
'COALESCE(LTRIM(RTRIM(' + 'CONVERT(char, ' + @Column_Name + ')' + ')),''NULL'')'
|
|
END + '+' + ''',''' + ' + '
|
|
|
|
--Generating the column list for the INSERT statement
|
|
SET @Column_List = @Column_List + @Column_Name + ','
|
|
|
|
SKIP_LOOP: --The label used in GOTO
|
|
|
|
SELECT @Column_ID = MIN(ORDINAL_POSITION)
|
|
FROM INFORMATION_SCHEMA.COLUMNS (NOLOCK)
|
|
WHERE TABLE_NAME = @table_name AND
|
|
ORDINAL_POSITION > @Column_ID AND
|
|
(@owner IS NULL OR TABLE_SCHEMA = @owner)
|
|
|
|
|
|
--Loop ends here!
|
|
END
|
|
|
|
--To get rid of the extra characters that got concatenated during the last run through the loop
|
|
SET @Column_List = LEFT(@Column_List,len(@Column_List) - 1)
|
|
SET @Actual_Values = LEFT(@Actual_Values,len(@Actual_Values) - 6)
|
|
|
|
IF LTRIM(@Column_List) = ''
|
|
BEGIN
|
|
RAISERROR('No columns to select. There should at least be one column to generate the output',16,1)
|
|
RETURN -1 --Failure. Reason: Looks like all the columns are ommitted using the @cols_to_exclude parameter
|
|
END
|
|
|
|
--Forming the final string that will be executed, to output the INSERT statements
|
|
IF (@include_column_list <> 0)
|
|
BEGIN
|
|
SET @Actual_Values =
|
|
'SELECT ' +
|
|
CASE WHEN @top IS NULL OR @top < 0 THEN '' ELSE ' TOP ' + LTRIM(STR(@top)) + ' ' END +
|
|
'''' + RTRIM(@Start_Insert) +
|
|
' ''+' + '''(' + RTRIM(@Column_List) + '''+' + ''')''' +
|
|
' +''VALUES(''+ ' + @Actual_Values + '+'')''' + ' ' +
|
|
COALESCE(@from,' FROM ' + CASE WHEN @owner IS NULL THEN '' ELSE '[' + LTRIM(RTRIM(@owner)) + '].' END + '[' + rtrim(@table_name) + ']' + '(NOLOCK)')
|
|
END
|
|
ELSE IF (@include_column_list = 0)
|
|
BEGIN
|
|
SET @Actual_Values =
|
|
'SELECT ' +
|
|
CASE WHEN @top IS NULL OR @top < 0 THEN '' ELSE ' TOP ' + LTRIM(STR(@top)) + ' ' END +
|
|
'''' + RTRIM(@Start_Insert) +
|
|
' '' +''VALUES(''+ ' + @Actual_Values + '+'')''' + ' ' +
|
|
COALESCE(@from,' FROM ' + CASE WHEN @owner IS NULL THEN '' ELSE '[' + LTRIM(RTRIM(@owner)) + '].' END + '[' + rtrim(@table_name) + ']' + '(NOLOCK)')
|
|
END
|
|
print @Actual_Values
|
|
--Determining whether to ouput any debug information
|
|
|
|
IF @debug_mode =1
|
|
BEGIN
|
|
PRINT '/*****START OF DEBUG INFORMATION*****'
|
|
PRINT 'Beginning of the INSERT statement:'
|
|
PRINT @Start_Insert
|
|
PRINT ''
|
|
PRINT 'The column list:'
|
|
PRINT @Column_List
|
|
PRINT ''
|
|
PRINT 'The SELECT statement executed to generate the INSERTs'
|
|
PRINT @Actual_Values
|
|
PRINT ''
|
|
PRINT '*****END OF DEBUG INFORMATION*****/'
|
|
PRINT ''
|
|
END
|
|
|
|
PRINT '--INSERTs generated by ''sp_generate_inserts'' stored procedure written by Vyas'
|
|
PRINT '--Build number: 22'
|
|
PRINT '--Problems/Suggestions? Contact Vyas @ vyaskn@hotmail.com'
|
|
PRINT '--http://vyaskn.tripod.com'
|
|
PRINT ''
|
|
PRINT 'SET NOCOUNT ON'
|
|
PRINT ''
|
|
|
|
|
|
--Determining whether to print IDENTITY_INSERT or not
|
|
IF (@IDN <> '')
|
|
BEGIN
|
|
PRINT 'SET IDENTITY_INSERT ' + QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + QUOTENAME(@table_name) + ' ON'
|
|
PRINT 'GO'
|
|
PRINT ''
|
|
END
|
|
|
|
|
|
IF @disable_constraints = 1 AND (OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name, 'U') IS NOT NULL)
|
|
BEGIN
|
|
IF @owner IS NULL
|
|
BEGIN
|
|
SELECT 'ALTER TABLE ' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' NOCHECK CONSTRAINT ALL' AS '--Code to disable constraints temporarily'
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SELECT 'ALTER TABLE ' + QUOTENAME(@owner) + '.' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' NOCHECK CONSTRAINT ALL' AS '--Code to disable constraints temporarily'
|
|
END
|
|
|
|
PRINT 'GO'
|
|
END
|
|
|
|
PRINT ''
|
|
PRINT 'PRINT ''Inserting values into ' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']' + ''''
|
|
|
|
|
|
--All the hard work pays off here!!! You'll get your INSERT statements, when the next line executes!
|
|
insert into _Statement EXEC (@Actual_Values)
|
|
|
|
PRINT 'PRINT ''Done'''
|
|
PRINT ''
|
|
|
|
|
|
IF @disable_constraints = 1 AND (OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name, 'U') IS NOT NULL)
|
|
BEGIN
|
|
IF @owner IS NULL
|
|
BEGIN
|
|
SELECT 'ALTER TABLE ' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' CHECK CONSTRAINT ALL' AS '--Code to enable the previously disabled constraints'
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SELECT 'ALTER TABLE ' + QUOTENAME(@owner) + '.' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' CHECK CONSTRAINT ALL' AS '--Code to enable the previously disabled constraints'
|
|
END
|
|
|
|
PRINT 'GO'
|
|
END
|
|
|
|
PRINT ''
|
|
IF (@IDN <> '')
|
|
BEGIN
|
|
PRINT 'SET IDENTITY_INSERT ' + QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + QUOTENAME(@table_name) + ' OFF'
|
|
PRINT 'GO'
|
|
END
|
|
|
|
PRINT 'SET NOCOUNT OFF'
|
|
|
|
|
|
SET NOCOUNT OFF
|
|
RETURN 0 --Success. We are done!
|
|
END-- ================================================
|
|
-- Template generated from Template Explorer using:
|
|
-- Create Procedure (New Menu).SQL
|
|
--
|
|
-- Use the Specify Values for Template Parameters
|
|
-- command (Ctrl-Shift-M) to fill in the parameter
|
|
-- values below.
|
|
--
|
|
-- This block of comments will not be included in
|
|
-- the definition of the procedure.
|
|
-- ================================================
|
|
SET ANSI_NULLS ON
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_Aktivitaetliste] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Aktivitaet'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[sp_get_Aktivitaetliste]
|
|
@mitarbeiternr int,
|
|
@aktivitaetstatusnr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
if @aktivitaetstatusnr < 1 begin
|
|
SELECT dbo.Aktivitaet.AktivitaetNr, dbo.Aktivitaet.Ereignisnr, dbo.Aktivitaet.AktivitaetStatusNr, dbo.AktivitaetStatus.Bezeichnung, dbo.Aktivitaet.Periodizitaetnr,
|
|
dbo.Periodizitaet.Bezeichnung AS Periodizitaet, dbo.Vertragselement.Vertragselementnr, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Aktivitaet.Ausgeloest_am, dbo.Aktivitaet.Ereignis, dbo.Aktivitaet.Kostenart, dbo.Aktivitaet.Betrag, dbo.Aktivitaet.Termin, dbo.Aktivitaet.Beschreibung,
|
|
dbo.Aktivitaet.Bemerkung, dbo.Aktivitaet.Securitylevelnr, dbo.Aktivitaet.Aktiv, dbo.Aktivitaet.Erstellt_am, dbo.Aktivitaet.Mutiert_am, dbo.Aktivitaet.Mutierer, dbo.aktivitaet.kuendigungsfrist
|
|
FROM dbo.Aktivitaet INNER JOIN
|
|
dbo.AktivitaetStatus ON dbo.Aktivitaet.AktivitaetStatusNr = dbo.AktivitaetStatus.AktivitaetStatusNr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Aktivitaet.Periodizitaetnr = dbo.Periodizitaet.PeriodizitaetNr INNER JOIN
|
|
dbo.Vertragsereignis ON dbo.Aktivitaet.Ereignisnr = dbo.Vertragsereignis.EreignisNr INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragsereignis.Vertragselementnr = dbo.Vertragselement.Vertragselementnr
|
|
where dbo.aktivitaet.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
ORDER BY termin Desc
|
|
end else begin
|
|
SELECT dbo.Aktivitaet.AktivitaetNr, dbo.Aktivitaet.Ereignisnr, dbo.Aktivitaet.AktivitaetStatusNr, dbo.AktivitaetStatus.Bezeichnung, dbo.Aktivitaet.Periodizitaetnr,
|
|
dbo.Periodizitaet.Bezeichnung AS Periodizitaet, dbo.Vertragselement.Vertragselementnr, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Aktivitaet.Ausgeloest_am, dbo.Aktivitaet.Ereignis, dbo.Aktivitaet.Kostenart, dbo.Aktivitaet.Betrag, dbo.Aktivitaet.Termin, dbo.Aktivitaet.Beschreibung,
|
|
dbo.Aktivitaet.Bemerkung, dbo.Aktivitaet.Securitylevelnr, dbo.Aktivitaet.Aktiv, dbo.Aktivitaet.Erstellt_am, dbo.Aktivitaet.Mutiert_am, dbo.Aktivitaet.Mutierer, dbo.aktivitaet.kuendigungsfrist
|
|
FROM dbo.Aktivitaet INNER JOIN
|
|
dbo.AktivitaetStatus ON dbo.Aktivitaet.AktivitaetStatusNr = dbo.AktivitaetStatus.AktivitaetStatusNr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Aktivitaet.Periodizitaetnr = dbo.Periodizitaet.PeriodizitaetNr INNER JOIN
|
|
dbo.Vertragsereignis ON dbo.Aktivitaet.Ereignisnr = dbo.Vertragsereignis.EreignisNr INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragsereignis.Vertragselementnr = dbo.Vertragselement.Vertragselementnr
|
|
where dbo.aktivitaet.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and dbo.aktivitaet.aktivitaetstatusnr=@aktivitaetstatusnr
|
|
|
|
union all
|
|
SELECT TOP (100) PERCENT dbo.Aktivitaet.AktivitaetNr, dbo.Aktivitaet.Ereignisnr, dbo.Aktivitaet.AktivitaetStatusNr, dbo.AktivitaetStatus.Bezeichnung,
|
|
dbo.Aktivitaet.Periodizitaetnr, dbo.Periodizitaet.Bezeichnung AS Periodizitaet, Vertragselement.Vertragselementnr, Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Aktivitaet.Ausgeloest_am, dbo.Aktivitaet.Ereignis, dbo.Aktivitaet.Kostenart, dbo.Aktivitaet.Betrag, dbo.Aktivitaet.Termin, dbo.Aktivitaet.Beschreibung,
|
|
dbo.Aktivitaet.Bemerkung, dbo.Aktivitaet.Securitylevelnr, dbo.Aktivitaet.Aktiv, dbo.Aktivitaet.Erstellt_am, dbo.Aktivitaet.Mutiert_am, dbo.Aktivitaet.Mutierer,
|
|
dbo.Aktivitaet.Kuendigungsfrist
|
|
FROM dbo.Vertragselement AS Vertragselement INNER JOIN
|
|
dbo.Aktivitaet INNER JOIN
|
|
dbo.AktivitaetStatus ON dbo.Aktivitaet.AktivitaetStatusNr = dbo.AktivitaetStatus.AktivitaetStatusNr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Aktivitaet.Periodizitaetnr = dbo.Periodizitaet.PeriodizitaetNr ON
|
|
Vertragselement.Vertragselementnr = dbo.Aktivitaet.Vertragselementnr
|
|
where dbo.aktivitaet.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and dbo.aktivitaet.aktivitaetstatusnr=@aktivitaetstatusnr
|
|
ORDER BY termin Desc
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <13.01.2008>
|
|
-- Description: <Auslesen der Struktur (inkl. Kategorien) der Applikationsverwaltung anhand eines Suchbegriffs>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_applstruktur]
|
|
@mitarbeiternr int,
|
|
@nuraktive int=0,
|
|
@alphasort int=0
|
|
AS
|
|
--exec sp_get_applstruktur_test @mitarbeiternr, @nuraktive,@alphasort
|
|
--return
|
|
CREATE TABLE #tmpd(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[kategorienr] [int] null,
|
|
[lic] bit null,
|
|
[aktiv] [bit] null,
|
|
[Strukturelement] [bit] null,
|
|
|
|
) ON [DEFAULT]
|
|
-- Rootentry für die Treeaufbereitung in der Applikation
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
declare @appnr int
|
|
declare @appbez varchar(50)
|
|
declare @appprnt int
|
|
declare @anr int
|
|
declare @bez varchar(50)
|
|
declare @pid int
|
|
declare @snr int
|
|
declare @aktiv bit
|
|
declare @knr int
|
|
set @appprnt = -1
|
|
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Erster Loop über die Applikationen, welche den entsprechenden Suchbegriff beinhalten
|
|
-----------------------------------------------------------------------------------------
|
|
SELECT DISTINCT dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation.ParentID, dbo.Applikation.SecurityLevelNr, dbo.Applikation.Aktiv
|
|
into #tmpx
|
|
FROM dbo.Applikation
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=0 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
|
|
declare xc cursor for
|
|
select * from #tmpx
|
|
open xc
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
-----------------------------------------------------------------------------------------
|
|
-- Zweiter Loop über die Einträge der obesten Ebene der Applikationen
|
|
-----------------------------------------------------------------------------------------
|
|
declare yc cursor for
|
|
select applikationnr, bezeichnung, parentid, securitylevelnr, applikationkategorienr, aktiv from applikation
|
|
where applikationnr=@appnr
|
|
open yc
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, kategorienr, aktiv)
|
|
values (@anr, @bez, @appprnt, @snr, @knr, @aktiv)
|
|
-----------------------------------------------------------------------------------------
|
|
-- Je Applikation die untergeordneten Applikationen/Module auslesen
|
|
-----------------------------------------------------------------------------------------
|
|
--execute dbo.sp_get_applstruktur_down @anr,1, @anr
|
|
execute dbo.sp_get_applstruktur_up @anr,1
|
|
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
end
|
|
close yc
|
|
deallocate yc
|
|
set @appprnt = @appprnt - 1
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
update #tmpd set kategorienr = (select applikationkategorienr*-1 from applikation where applikationnr=#tmpd.applikationsnr and #tmpd.parentid=0)
|
|
update #tmpd set parentid=kategorienr where kategorienr < 0
|
|
declare kc cursor for
|
|
SELECT distinct dbo.ApplikationKategorie.ApplikationKategorieNr, dbo.ApplikationKategorie.Bezeichnung
|
|
FROM dbo.Applikation inner join
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr inner join
|
|
dbo.#tmpd ON dbo.Applikation.ApplikationNr = dbo.#tmpd.applikationsnr
|
|
open kc
|
|
fetch next from kc into @knr, @bez
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv)
|
|
values (@knr * -1, @bez, 0, 0, @aktiv)
|
|
fetch next from kc into @knr, @bez
|
|
end
|
|
close kc
|
|
deallocate kc
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Daten zurück geben und temporäre Tabelle löschen
|
|
-----------------------------------------------------------------------------------------
|
|
delete from #tmpd where kategorienr is null and parentid < 0 or applikationsnr is null
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
update #tmpd set lic=0, Strukturelement=0
|
|
update #tmpd set lic=NurLizenz, Strukturelement = applikation.strukturelement from applikation where #tmpd.applikationsnr=applikation.applikationnr
|
|
|
|
if @alphasort = 1 begin
|
|
update #tmpd set parentid=0 where parentid<0
|
|
delete from #tmpd where applikationsnr < 0
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,'' as Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,'' as Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_20100911] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <13.01.2008>
|
|
-- Description: <Auslesen der Struktur (inkl. Kategorien) der Applikationsverwaltung anhand eines Suchbegriffs>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_applstruktur_20100911]
|
|
@mitarbeiternr int,
|
|
@nuraktive int=0,
|
|
@alphasort int=0
|
|
AS
|
|
CREATE TABLE #tmpd(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[kategorienr] [int] null,
|
|
[lic] bit null,
|
|
[aktiv] [bit] null,
|
|
[Strukturelement] [bit] null,
|
|
) ON [DEFAULT]
|
|
-- Rootentry für die Treeaufbereitung in der Applikation
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
declare @appnr int
|
|
declare @appbez varchar(50)
|
|
declare @appprnt int
|
|
declare @anr int
|
|
declare @bez varchar(50)
|
|
declare @pid int
|
|
declare @snr int
|
|
declare @aktiv bit
|
|
declare @knr int
|
|
set @appprnt = -1
|
|
-----------------------------------------------------------------------------------------
|
|
-- Erster Loop über die Applikationen, welche den entsprechenden Suchbegriff beinhalten
|
|
-----------------------------------------------------------------------------------------
|
|
SELECT DISTINCT dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation.ParentID, dbo.Applikation.SecurityLevelNr, dbo.Applikation.Aktiv
|
|
into #tmpx
|
|
FROM dbo.Applikation left outer join
|
|
dbo.ApplikationKontakt ON dbo.Applikation.ApplikationNr = dbo.ApplikationKontakt.Applikationnr left outer join
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=0 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
declare xc cursor for
|
|
|
|
select * from #tmpx
|
|
-- select Applikationnr, bezeichnung, parentid, securitylevelnr, aktiv from applikation
|
|
-- where bezeichnung like @suchstring or kurzbeschreibung like @suchstring
|
|
open xc
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
--insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv)
|
|
-- values (@appnr, @appbez, @pid ,@snr, @aktiv)
|
|
-----------------------------------------------------------------------------------------
|
|
-- Zweiter Loop über die Einträge der obesten Ebene der Applikationen
|
|
-----------------------------------------------------------------------------------------
|
|
declare yc cursor for
|
|
select applikationnr, bezeichnung, parentid, securitylevelnr, applikationkategorienr, aktiv from applikation
|
|
where applikationnr=@appnr
|
|
open yc
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, kategorienr, aktiv)
|
|
values (@anr, @bez, @appprnt, @snr, @knr, @aktiv)
|
|
-----------------------------------------------------------------------------------------
|
|
-- Je Applikation die untergeordneten Applikationen/Module auslesen
|
|
-----------------------------------------------------------------------------------------
|
|
--execute dbo.sp_get_applstruktur_down @anr,1, @anr
|
|
execute dbo.sp_get_applstruktur_up @anr,1
|
|
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
end
|
|
close yc
|
|
deallocate yc
|
|
set @appprnt = @appprnt - 1
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
update #tmpd set kategorienr = (select applikationkategorienr*-1 from applikation where applikationnr=#tmpd.applikationsnr and #tmpd.parentid=0)
|
|
update #tmpd set parentid=kategorienr where kategorienr < 0
|
|
declare kc cursor for
|
|
SELECT distinct dbo.ApplikationKategorie.ApplikationKategorieNr, dbo.ApplikationKategorie.Bezeichnung
|
|
FROM dbo.Applikation inner join
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr inner join
|
|
dbo.#tmpd ON dbo.Applikation.ApplikationNr = dbo.#tmpd.applikationsnr
|
|
open kc
|
|
fetch next from kc into @knr, @bez
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv)
|
|
values (@knr * -1, @bez, 0, 0, @aktiv)
|
|
fetch next from kc into @knr, @bez
|
|
end
|
|
close kc
|
|
deallocate kc
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Daten zurück geben und temporäre Tabelle löschen
|
|
-----------------------------------------------------------------------------------------
|
|
delete from #tmpd where kategorienr is null and parentid < 0 or applikationsnr is null
|
|
--delete from #tmpd where kategorienr is null and (parentid 0 or parentid is null)
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
update #tmpd set lic=0
|
|
update #tmpd set lic=NurLizenz from applikation where #tmpd.applikationsnr=applikation.applikationnr
|
|
update #tmpd set strukturelement=0
|
|
update #tmpd set Strukturelement = applikation.strukturelement from applikation where #tmpd.applikationsnr=applikation.applikationnr
|
|
|
|
if @alphasort = 1 begin
|
|
update #tmpd set parentid=0 where parentid<0
|
|
delete from #tmpd where applikationsnr < 0
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
--select distinct applikationsnr, bezeichnung, parentid, lic, aktiv from #tmpd order by bezeichnung
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_all] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_applstruktur_all]
|
|
|
|
AS
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
CREATE TABLE #tmpd(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[kategorienr] [int] null,
|
|
[level] [int] null,
|
|
[TicketXPertVerwendung] bit null,
|
|
[TicketXPert_WPIAnzeigen] bit null,
|
|
[TicketXPert_Preis] varchar(255) null,
|
|
[TicketXPert_Preis_Einmalig] varchar (255) null,
|
|
[TicketXPert_AMAnzeigen] bit null,
|
|
[TicketXPert_ApplikationSMLTypNr] int null
|
|
|
|
) ON [DEFAULT]
|
|
|
|
|
|
|
|
declare @anr int
|
|
declare @anr1 int
|
|
declare xc cursor for
|
|
select applikationkategorienr from applikationkategorie order by bezeichnung
|
|
open xc
|
|
fetch next from xc into @anr
|
|
while @@FETCH_STATUS=0 begin
|
|
declare xx cursor for select applikationnr from applikation where applikationkategorienr=@anr and parentid=0 and aktiv=1 order by bezeichnung
|
|
open xx
|
|
fetch next from xx into @anr1
|
|
while @@FETCH_STATUS=0 begin
|
|
WITH DirectReports(Parentid, ApplikationNr, bezeichnung,kategorie,EmployeeLevel,
|
|
TicketXPertVerwendung,ticketxpert_wpianzeigen, TicketXPert_Preis,TicketXPert_Preis_Einmalig,
|
|
TicketXPert_AMAnzeigen,TicketXPert_ApplikationSMLTypNr) AS
|
|
(
|
|
SELECT Parentid, Applikationnr, Bezeichnung,ApplikationKategorieNr, 0 AS EmployeeLevel,
|
|
TicketXPertVerwendung,ticketxpert_wpianzeigen, TicketXPert_Preis,TicketXPert_Preis_Einmalig,
|
|
TicketXPert_AMAnzeigen,TicketXPert_ApplikationSMLTypNr
|
|
FROM Applikation
|
|
WHERE Parentid =0 and ApplikationNr=@anr1 and aktiv=1
|
|
UNION ALL
|
|
SELECT e.Parentid, e.Applikationnr, e.bezeichnung, e.ApplikationKategorieNr, EmployeeLevel + 1,
|
|
e.TicketXPertVerwendung,e.ticketxpert_wpianzeigen, e.TicketXPert_Preis,e.TicketXPert_Preis_Einmalig,
|
|
e.TicketXPert_AMAnzeigen, e.TicketXPert_ApplikationSMLTypNr
|
|
FROM Applikation e
|
|
INNER JOIN DirectReports d
|
|
ON e.ParentID = d.Applikationnr
|
|
where e.Aktiv=1
|
|
)
|
|
|
|
insert into #tmpd select Applikationnr, REPLICATE('___ ', EmployeeLevel)+bezeichnung, parentid, kategorie ,EmployeeLevel
|
|
,TicketXPertVerwendung,ticketxpert_wpianzeigen, TicketXPert_Preis,TicketXPert_Preis_Einmalig,
|
|
TicketXPert_AMAnzeigen,TicketXPert_ApplikationSMLTypNr
|
|
FROM DirectReports
|
|
fetch next from xx into @anr1
|
|
end
|
|
close xx
|
|
deallocate xx
|
|
fetch next from xc into @anr
|
|
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
select #tmpd.applikationsnr, ApplikationKategorie.Bezeichnung as Kategorie, #tmpd.bezeichnung as applikation,
|
|
#tmpd.TicketXPertVerwendung,#tmpd.ticketxpert_wpianzeigen, #tmpd.TicketXPert_Preis,#tmpd.TicketXPert_Preis_Einmalig,
|
|
#tmpd.TicketXPert_AMAnzeigen, dbo.ApplikationSLMTyp.Bezeichnung as SLM
|
|
from #tmpd left outer joiN
|
|
dbo.ApplikationSLMTyp ON #tmpd.TicketXPert_ApplikationSMLTypNr = dbo.applikationslmtyp.ApplikationSLMTypNr
|
|
inner join dbo.ApplikationKategorie on #tmpd.kategorienr=dbo.ApplikationKategorie.ApplikationKategorieNr
|
|
|
|
end
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_down] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_get_applstruktur_down]
|
|
@Root int,
|
|
@imandant int,
|
|
@vnr int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
declare @anr int, @bez varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit
|
|
select @bez=bezeichnung, @nr=applikationnr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv
|
|
from applikation
|
|
where applikationnr=@root
|
|
if @parent > 0 begin
|
|
insert into #tmpd (applikationsnr, bezeichnung, parentid,aktiv) values
|
|
(@nr, @bez, @parent,@aktiv)
|
|
end
|
|
set @anr=(select min (applikationnr) from applikation where parentid=@root)
|
|
while @anr is not null begin
|
|
exec dbo.sp_get_applstruktur_down @anr, 1, -1
|
|
set @anr=(select min (applikationnr) from dbo.applikation where parentid=@root and applikationnr>@anr)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_suche] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <13.01.2008>
|
|
-- Description: <Auslesen der Struktur (inkl. Kategorien) der Applikationsverwaltung anhand eines Suchbegriffs>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_applstruktur_suche]
|
|
@suchstring varchar(255),
|
|
@mitarbeiternr int,
|
|
@nuraktive int=0,
|
|
@arcobject bit=0,
|
|
@alphasort int=0,
|
|
@suche int=0
|
|
AS
|
|
|
|
if @suchstring='' set @suche=0
|
|
CREATE TABLE #tmpx(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[aktiv] [bit] null,
|
|
--[strukturelement] [bit] null,
|
|
[Treffer] [varchar] (1) null,
|
|
) ON [DEFAULT]
|
|
CREATE TABLE #tmpd(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[kategorienr] [int] null,
|
|
[lic] bit null,
|
|
[aktiv] [bit] null,
|
|
[strukturelement] [bit] null,
|
|
[Treffer] [varchar] (1) null,
|
|
) ON [DEFAULT]
|
|
|
|
|
|
-- Rootentry für die Treeaufbereitung in der Applikation
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
declare @appnr int
|
|
declare @appbez varchar(50)
|
|
declare @appprnt int
|
|
declare @anr int
|
|
declare @bez varchar(50)
|
|
declare @pid int
|
|
declare @snr int
|
|
declare @aktiv bit
|
|
declare @knr int
|
|
set @appprnt = -1
|
|
-----------------------------------------------------------------------------------------
|
|
-- Erster Loop über die Applikationen, welche den entsprechenden Suchbegriff beinhalten
|
|
-----------------------------------------------------------------------------------------
|
|
-- Suche über Architekturobjekte
|
|
if @arcobject=1 begin
|
|
set @suchstring='%' + @suchstring + '%'
|
|
insert #tmpx
|
|
SELECT dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung,
|
|
dbo.Applikation.ParentID, dbo.Applikation.SecurityLevelNr,
|
|
dbo.Applikation.Aktiv--,dbo.Applikation.Strukturelement
|
|
,'*' as Treffer
|
|
FROM dbo.ApplikationArchitekturObjectAppl RIGHT OUTER JOIN
|
|
dbo.Applikation INNER JOIN
|
|
dbo.ApplikationArchitekturObject ON dbo.Applikation.ApplikationNr = dbo.ApplikationArchitekturObject.ApplikationNr LEFT OUTER JOIN
|
|
dbo.ApplikationArchitekturObjectDB AS ApplikationArchitekturObjectDB_1 ON dbo.ApplikationArchitekturObject.Guid = ApplikationArchitekturObjectDB_1.Guid ON
|
|
dbo.ApplikationArchitekturObjectAppl.Guid = dbo.ApplikationArchitekturObject.Guid
|
|
WHERE (dbo.ApplikationArchitekturObject.Name LIKE @suchstring) OR
|
|
(dbo.ApplikationArchitekturObject.Description LIKE @suchstring) OR
|
|
(dbo.ApplikationArchitekturObjectAppl.Applikation LIKE @suchstring) OR
|
|
(dbo.ApplikationArchitekturObjectAppl.Beschreibung LIKE @suchstring) OR
|
|
(ApplikationArchitekturObjectDB_1.Datenbank LIKE @suchstring) OR
|
|
(ApplikationArchitekturObjectDB_1.Beschreibung LIKE @suchstring)
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=0 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
end else begin
|
|
set @suchstring='%' + @suchstring + '%'
|
|
insert #tmpx SELECT DISTINCT dbo.Applikation.ApplikationNr,
|
|
dbo.Applikation.Bezeichnung,
|
|
dbo.Applikation.ParentID,
|
|
dbo.Applikation.SecurityLevelNr,
|
|
dbo.Applikation.Aktiv
|
|
--, dbo.Applikation.Strukturelement
|
|
,'*' as Treffer
|
|
FROM dbo.Applikation left outer JOIN
|
|
dbo.ApplikationKontakt ON dbo.Applikation.ApplikationNr = dbo.ApplikationKontakt.Applikationnr left outer JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr
|
|
WHERE bezeichnung like @suchstring or kurzbeschreibung like @suchstring or dbo.person.name like @suchstring or dbo.person.vorname like @suchstring
|
|
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=0 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
end
|
|
|
|
declare xc cursor for
|
|
|
|
select [applikationsnr], [bezeichnung],[parentid],[SecurityLevelNr],[aktiv] from #tmpx
|
|
|
|
-- select Applikationnr, bezeichnung, parentid, securitylevelnr, aktiv from applikation
|
|
-- where bezeichnung like @suchstring or kurzbeschreibung like @suchstring
|
|
open xc
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
|
|
--insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv)
|
|
-- values (@appnr, @appbez, @pid ,@snr, @aktiv)
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Zweiter Loop über die Einträge der obesten Ebene der Applikationen
|
|
-----------------------------------------------------------------------------------------
|
|
declare yc cursor for
|
|
select applikationnr, bezeichnung, parentid, securitylevelnr, applikationkategorienr, aktiv from applikation
|
|
where applikationnr=@appnr
|
|
open yc
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, kategorienr, aktiv)
|
|
values (@anr, @bez, @appprnt, @snr, @knr, @aktiv)
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Je Applikation die untergeordneten Applikationen/Module auslesen
|
|
-----------------------------------------------------------------------------------------
|
|
--execute dbo.sp_get_applstruktur_down @anr,1, @anr
|
|
execute dbo.sp_get_applstruktur_up @anr,1
|
|
|
|
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
end
|
|
close yc
|
|
deallocate yc
|
|
|
|
set @appprnt = @appprnt - 1
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
update #tmpd set kategorienr = (select applikationkategorienr*-1 from applikation where applikationnr=#tmpd.applikationsnr and #tmpd.parentid=0)
|
|
update #tmpd set parentid=kategorienr where kategorienr < 0
|
|
|
|
declare kc cursor for
|
|
SELECT distinct dbo.ApplikationKategorie.ApplikationKategorieNr, dbo.ApplikationKategorie.Bezeichnung
|
|
FROM dbo.Applikation INNER JOIN
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN
|
|
dbo.#tmpd ON dbo.Applikation.ApplikationNr = dbo.#tmpd.applikationsnr
|
|
open kc
|
|
fetch next from kc into @knr, @bez
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv)
|
|
values (@knr * -1, @bez, 0, 0, @aktiv)
|
|
fetch next from kc into @knr, @bez
|
|
end
|
|
close kc
|
|
deallocate kc
|
|
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Daten zurück geben und temporäre Tabelle löschen
|
|
-----------------------------------------------------------------------------------------
|
|
delete from #tmpd where kategorienr is null and parentid < 0 or applikationsnr is null
|
|
--delete from #tmpd where kategorienr is null and (parentid 0 or parentid is null)
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
update #tmpd set lic=0
|
|
update #tmpd set lic=NurLizenz from applikation where #tmpd.applikationsnr=applikation.applikationnr
|
|
update #tmpd set strukturelement=0
|
|
Update #tmpd set strukturelement=applikation.strukturelement from applikation where #tmpd.applikationsnr=applikation.applikationnr
|
|
|
|
if @alphasort = 1 begin
|
|
update #tmpd set parentid=0 where parentid<0
|
|
delete from #tmpd where applikationsnr < 0
|
|
|
|
if @suche=1 begin
|
|
update #tmpd set treffer='*' where [applikationsnr] in (select [applikationsnr] from #tmpx)
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
if @suche=1 begin
|
|
update #tmpd set treffer='*' where [applikationsnr] in (select [applikationsnr] from #tmpx)
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,treffer from #tmpd order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,treffer from #tmpd order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,treffer from #tmpd order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement,treffer from #tmpd order by bezeichnung
|
|
-- select distinct applikationsnr, bezeichnung, parentid, lic, aktiv from #tmpd where aktiv=1 order by bezeichnung
|
|
end
|
|
|
|
|
|
drop table #tmpd
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_suche_20100911] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <13.01.2008>
|
|
-- Description: <Auslesen der Struktur (inkl. Kategorien) der Applikationsverwaltung anhand eines Suchbegriffs>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_applstruktur_suche_20100911]
|
|
@suchstring varchar(255),
|
|
@mitarbeiternr int,
|
|
@nuraktive int=0,
|
|
@arcobject bit=0,
|
|
@alphasort int=0
|
|
AS
|
|
CREATE TABLE #tmpx(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[aktiv] [bit] null,
|
|
--[strukturelement] [bit] null,
|
|
) ON [DEFAULT]
|
|
CREATE TABLE #tmpd(
|
|
[applikationsnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[kategorienr] [int] null,
|
|
[lic] bit null,
|
|
[aktiv] [bit] null,
|
|
[strukturelement] [bit] null,
|
|
) ON [DEFAULT]
|
|
|
|
-- Rootentry für die Treeaufbereitung in der Applikation
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
declare @appnr int
|
|
declare @appbez varchar(50)
|
|
declare @appprnt int
|
|
declare @anr int
|
|
declare @bez varchar(50)
|
|
declare @pid int
|
|
declare @snr int
|
|
declare @aktiv bit
|
|
declare @knr int
|
|
set @appprnt = -1
|
|
-----------------------------------------------------------------------------------------
|
|
-- Erster Loop über die Applikationen, welche den entsprechenden Suchbegriff beinhalten
|
|
-----------------------------------------------------------------------------------------
|
|
-- Suche über Architekturobjekte
|
|
if @arcobject=1 begin
|
|
set @suchstring='%' + @suchstring + '%'
|
|
insert #tmpx
|
|
SELECT dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung,
|
|
dbo.Applikation.ParentID, dbo.Applikation.SecurityLevelNr,
|
|
dbo.Applikation.Aktiv--,dbo.Applikation.Strukturelement
|
|
FROM dbo.ApplikationArchitekturObjectAppl RIGHT OUTER JOIN
|
|
dbo.Applikation INNER JOIN
|
|
dbo.ApplikationArchitekturObject ON dbo.Applikation.ApplikationNr = dbo.ApplikationArchitekturObject.ApplikationNr LEFT OUTER JOIN
|
|
dbo.ApplikationArchitekturObjectDB AS ApplikationArchitekturObjectDB_1 ON dbo.ApplikationArchitekturObject.Guid = ApplikationArchitekturObjectDB_1.Guid ON
|
|
dbo.ApplikationArchitekturObjectAppl.Guid = dbo.ApplikationArchitekturObject.Guid
|
|
WHERE (dbo.ApplikationArchitekturObject.Name LIKE @suchstring) OR
|
|
(dbo.ApplikationArchitekturObject.Description LIKE @suchstring) OR
|
|
(dbo.ApplikationArchitekturObjectAppl.Applikation LIKE @suchstring) OR
|
|
(dbo.ApplikationArchitekturObjectAppl.Beschreibung LIKE @suchstring) OR
|
|
(ApplikationArchitekturObjectDB_1.Datenbank LIKE @suchstring) OR
|
|
(ApplikationArchitekturObjectDB_1.Beschreibung LIKE @suchstring)
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=0 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
end else begin
|
|
print 'b'
|
|
set @suchstring='%' + @suchstring + '%'
|
|
insert #tmpx SELECT DISTINCT dbo.Applikation.ApplikationNr,
|
|
dbo.Applikation.Bezeichnung,
|
|
dbo.Applikation.ParentID,
|
|
dbo.Applikation.SecurityLevelNr,
|
|
dbo.Applikation.Aktiv
|
|
--, dbo.Applikation.Strukturelement
|
|
FROM dbo.Applikation left outer JOIN
|
|
dbo.ApplikationKontakt ON dbo.Applikation.ApplikationNr = dbo.ApplikationKontakt.Applikationnr left outer JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr
|
|
WHERE bezeichnung like @suchstring or kurzbeschreibung like @suchstring or dbo.person.name like @suchstring or dbo.person.vorname like @suchstring
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @nuraktive=0 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
end
|
|
|
|
declare xc cursor for
|
|
|
|
select * from #tmpx
|
|
|
|
-- select Applikationnr, bezeichnung, parentid, securitylevelnr, aktiv from applikation
|
|
-- where bezeichnung like @suchstring or kurzbeschreibung like @suchstring
|
|
open xc
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
|
|
--insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv)
|
|
-- values (@appnr, @appbez, @pid ,@snr, @aktiv)
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Zweiter Loop über die Einträge der obesten Ebene der Applikationen
|
|
-----------------------------------------------------------------------------------------
|
|
declare yc cursor for
|
|
select applikationnr, bezeichnung, parentid, securitylevelnr, applikationkategorienr, aktiv from applikation
|
|
where applikationnr=@appnr
|
|
open yc
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, kategorienr, aktiv)
|
|
values (@anr, @bez, @appprnt, @snr, @knr, @aktiv)
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Je Applikation die untergeordneten Applikationen/Module auslesen
|
|
-----------------------------------------------------------------------------------------
|
|
--execute dbo.sp_get_applstruktur_down @anr,1, @anr
|
|
execute dbo.sp_get_applstruktur_up @anr,1
|
|
|
|
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @knr, @aktiv
|
|
end
|
|
close yc
|
|
deallocate yc
|
|
|
|
set @appprnt = @appprnt - 1
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
update #tmpd set kategorienr = (select applikationkategorienr*-1 from applikation where applikationnr=#tmpd.applikationsnr and #tmpd.parentid=0)
|
|
update #tmpd set parentid=kategorienr where kategorienr < 0
|
|
|
|
declare kc cursor for
|
|
SELECT distinct dbo.ApplikationKategorie.ApplikationKategorieNr, dbo.ApplikationKategorie.Bezeichnung
|
|
FROM dbo.Applikation INNER JOIN
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN
|
|
dbo.#tmpd ON dbo.Applikation.ApplikationNr = dbo.#tmpd.applikationsnr
|
|
open kc
|
|
fetch next from kc into @knr, @bez
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv)
|
|
values (@knr * -1, @bez, 0, 0, @aktiv)
|
|
fetch next from kc into @knr, @bez
|
|
end
|
|
close kc
|
|
deallocate kc
|
|
|
|
|
|
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Daten zurück geben und temporäre Tabelle löschen
|
|
-----------------------------------------------------------------------------------------
|
|
delete from #tmpd where kategorienr is null and parentid < 0 or applikationsnr is null
|
|
--delete from #tmpd where kategorienr is null and (parentid 0 or parentid is null)
|
|
insert #tmpd (applikationsnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
update #tmpd set lic=0
|
|
update #tmpd set lic=NurLizenz from applikation where #tmpd.applikationsnr=applikation.applikationnr
|
|
update #tmpd set strukturelement=0
|
|
Update #tmpd set strukturelement=applikation.strukturelement from applikation where #tmpd.applikationsnr=applikation.applikationnr
|
|
|
|
if @alphasort = 1 begin
|
|
update #tmpd set parentid=0 where parentid<0
|
|
delete from #tmpd where applikationsnr < 0
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
--select distinct applikationsnr, bezeichnung, parentid, lic, aktiv from #tmpd order by bezeichnung
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd order by bezeichnung
|
|
end else begin
|
|
select distinct applikationsnr, bezeichnung, parentid, lic, aktiv, strukturelement from #tmpd order by bezeichnung
|
|
-- select distinct applikationsnr, bezeichnung, parentid, lic, aktiv from #tmpd where aktiv=1 order by bezeichnung
|
|
end
|
|
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_applstruktur_up] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_get_applstruktur_up]
|
|
@Root int,
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
print 'hallo'
|
|
SET NOCOUNT ON
|
|
|
|
declare @applid int, @bezeichnung varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit
|
|
|
|
select @bezeichnung=bezeichnung, @nr=applikationnr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv from applikation
|
|
where applikationnr=@root
|
|
insert into #tmpd (applikationsnr, bezeichnung, parentid, securitylevelnr, aktiv) values (@nr, @bezeichnung, @parent,@seclevel,@aktiv)
|
|
|
|
set @applid=(select parentid from applikation where applikationnr=@nr)
|
|
|
|
while @applid is not null begin
|
|
exec dbo.sp_get_applstruktur_up @applid, 1
|
|
set @applid=(select parentid from dbo.applikation
|
|
where applikationnr = @nr and parentid>@applid)
|
|
end
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_auswertungen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_auswertungen]
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
SELECT DISTINCT
|
|
dbo.AuswertungGruppe.AuswertungGruppeNr, dbo.AuswertungGruppe.Bezeichnung AS Gruppe, dbo.Auswertung.AuswertungNr,
|
|
dbo.Auswertung.Bezeichnung AS Auswertung, dbo.AuswertungGruppeAuswertung.AuswertungGruppeNr AS Expr1
|
|
FROM dbo.AuswertungGruppe INNER JOIN
|
|
dbo.funktionsgruppe_auswertungGruppe ON dbo.AuswertungGruppe.AuswertungGruppeNr = dbo.funktionsgruppe_auswertungGruppe.AuswertungGruppeNr INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.funktionsgruppe_auswertungGruppe.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.mitarbeiter_funktionsgruppe ON dbo.funktionsgruppe.funktionsgruppenr = dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr INNER JOIN
|
|
dbo.AuswertungGruppeAuswertung ON dbo.AuswertungGruppe.AuswertungGruppeNr = dbo.AuswertungGruppeAuswertung.AuswertungGruppeNr INNER JOIN
|
|
dbo.Auswertung ON dbo.AuswertungGruppeAuswertung.AuswertungNr = dbo.Auswertung.AuswertungNr
|
|
WHERE (dbo.AuswertungGruppe.Aktiv = 1) AND (dbo.funktionsgruppe_auswertungGruppe.Aktiv = 1) AND (dbo.funktionsgruppe.aktiv = 1) AND
|
|
(dbo.mitarbeiter_funktionsgruppe.aktiv = 1) AND (dbo.AuswertungGruppeAuswertung.Aktiv = 1) AND (dbo.Auswertung.Aktiv = 1) AND
|
|
(dbo.mitarbeiter_funktionsgruppe.mitarbeiternr = @mitarbeiternr)
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_dbkey] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
CREATE PROCEDURE [dbo].[sp_get_dbkey]
|
|
@tablename varchar(255),
|
|
@dbkey int output,
|
|
@iErrorcode int output
|
|
AS
|
|
BEGIN
|
|
declare @zwkey int
|
|
select @zwkey = key_wert from key_tabelle where beschreibung = @tablename
|
|
set @zwkey = @zwkey + 1
|
|
update key_tabelle set key_wert = @zwkey where beschreibung=@tablename
|
|
select @dbkey = @zwkey
|
|
select @iErrorCode=@@Error
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_dokumente] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
Create PROCEDURE [dbo].[sp_get_dokumente]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@keyvalue int,
|
|
@doktype int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SELECT 0 as DokIcon, dbo.Dokument.DokumentNr, dbo.Dokument.KeyValue, dbo.Dokumenttyp.Bezeichnung as Dokumenttyp, dbo.Dokument.Bezeichnung AS Bezeichnung, dbo.Dokument.Beschreibung,
|
|
dbo.Dokument.Filename, dbo.Dokument.OriginalFilename_incl_Path, dbo.Dokument.Version, dbo.Dokument.VersionsNr, dbo.Dokument.Versionsdatum,
|
|
dbo.Dokument.Erstellt_am, dbo.Dokument.Mutiert_am, dbo.Dokument.Mutierer, dbo.Dokument.Aktiv, dbo.Dokument.SecurityLevelNr
|
|
FROM dbo.Dokument INNER JOIN
|
|
dbo.Dokumenttyp ON dbo.Dokument.DokumenttypNr = dbo.Dokumenttyp.Dokumenttypnr
|
|
where dbo.dokument.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and Keyvalue = @keyvalue and doktype=@doktype
|
|
order by dbo.dokument.erstellt_am desc
|
|
|
|
|
|
|
|
RETURN
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_gremium] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_gremium]
|
|
@type int,
|
|
@subtype int
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON;
|
|
if @type=1 begin
|
|
-- 1: Verantwortung
|
|
SELECT dbo.GremiumGruppierung.GremiumGruppierungNr as Keyvalue, dbo.GremiumGruppierung.Gruppierungsbegriff as Bezeichnung
|
|
FROM dbo.Gremium INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Gremium.GremiumNr = dbo.GremiumGruppierung.GremiumNr
|
|
WHERE dbo.GremiumGruppierung.Aktiv = 1 AND dbo.GremiumGruppierung.GremiumNr = 3
|
|
order by bezeichnung
|
|
end
|
|
-- 2: Team
|
|
if @type=2 begin
|
|
SELECT dbo.GremiumBereich.GremiumBereichNr as Keyvalue, dbo.GremiumBereich.Bereich as Bezeichnung
|
|
FROM dbo.GremiumGruppierung INNER JOIN
|
|
dbo.GremiumBereich ON dbo.GremiumGruppierung.GremiumGruppierungNr = dbo.GremiumBereich.GremiumGruppierungNr
|
|
WHERE dbo.GremiumBereich.GremiumGruppierungNr = @subtype and dbo.GremiumBereich.aktiv=1
|
|
order by dbo.gremiumbereich.Bereich
|
|
end
|
|
if @type=3 begin
|
|
-- 3: Marktbereich
|
|
SELECT dbo.GremiumGruppierung.GremiumGruppierungNr as Keyvalue, dbo.GremiumGruppierung.Gruppierungsbegriff as Bezeichnung
|
|
FROM dbo.Gremium INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Gremium.GremiumNr = dbo.GremiumGruppierung.GremiumNr
|
|
WHERE dbo.GremiumGruppierung.Aktiv = 1 AND dbo.GremiumGruppierung.GremiumNr = 4
|
|
order by bezeichnung
|
|
end
|
|
if @type=4 begin
|
|
-- 4: RFC-Board
|
|
SELECT dbo.GremiumBereich.GremiumBereichNr as Keyvalue, dbo.GremiumBereich.Bereich as Bezeichnung
|
|
FROM dbo.GremiumGruppierung INNER JOIN
|
|
dbo.GremiumBereich ON dbo.GremiumGruppierung.GremiumGruppierungNr = dbo.GremiumBereich.GremiumGruppierungNr INNER JOIN
|
|
dbo.Gremium ON dbo.GremiumGruppierung.GremiumNr = dbo.Gremium.GremiumNr
|
|
WHERE dbo.Gremium.GremiumNr = 1 and gremiumbereich.aktiv=1
|
|
order by Bereich
|
|
end
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_LCdokumente] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_get_LCdokumente]
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Kuendigungsfrist'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
@keyvalue int,
|
|
@doktype int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SELECT 0 as DokIcon, dbo.lc_Dokument.DokumentNr, dbo.lc_Dokument.KeyValue, dbo.lc_Dokumenttyp.Bezeichnung as Dokumenttyp, dbo.lc_Dokument.Bezeichnung AS Bezeichnung, dbo.lc_Dokument.Beschreibung,
|
|
dbo.lc_Dokument.Filename, dbo.lc_Dokument.OriginalFilename_incl_Path, dbo.lc_Dokument.Version, dbo.lc_Dokument.VersionsNr, dbo.lc_Dokument.Versionsdatum,
|
|
dbo.lc_Dokument.Erstellt_am, dbo.lc_Dokument.Mutiert_am, dbo.lc_Dokument.Mutierer, dbo.lc_Dokument.Aktiv, dbo.lc_Dokument.DocImage, 0 as DokIdon
|
|
FROM dbo.lc_Dokument INNER JOIN
|
|
dbo.lc_Dokumenttyp ON dbo.lc_Dokument.DokumenttypNr = dbo.lc_Dokumenttyp.Dokumenttypnr
|
|
where Keyvalue = @keyvalue and doktype=@doktype
|
|
order by dbo.lc_dokument.erstellt_am desc
|
|
|
|
|
|
|
|
RETURN
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_lizenz_lizenzkauf] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_lizenz_lizenzkauf]
|
|
@Lizenznr int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
SELECT dbo.Lizenzkauf.LizenzkaufNr, dbo.Lizenzkauf.Vertragselementapplikationnr, dbo.Lizenzkauf.Anzahl, dbo.Lizenzkauf.Kaufdatum, dbo.Lizenzkauf.KGNummer,
|
|
dbo.Lizenzkauf.SAPNummer, dbo.Lizenzkauf.Gueltigbis, dbo.Lizenzkauf.Statusnr, dbo.Lizenzkauf.Bemerkung, dbo.Lizenzkauf.Aktiv, dbo.Lizenzkauf.Erstellt_am,
|
|
dbo.Lizenzkauf.Mutiert_am, dbo.Lizenzkauf.Mutierer,dbo.Lizenzkauf.Lizenznr, dbo.Lizenztyp.Bezeichnung as Lizenztypnr
|
|
FROM dbo.Lizenzkauf INNER JOIN
|
|
dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr
|
|
where dbo.Lizenzkauf.Lizenznr=@lizenznr
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_Lizenz_VEApplElemente] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
create PROCEDURE [dbo].[sp_get_Lizenz_VEApplElemente]
|
|
@mitarbeiternr int,
|
|
@vertragspartnernr int
|
|
as
|
|
BEGIN
|
|
SELECT TOP (100) PERCENT dbo.VertragselementApplikation.VertragselementApplikationnr, dbo.VertragselementApplikation.Vertragselementnr,
|
|
dbo.VertragselementApplikation.Applikationnr, dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Applikation.Bezeichnung AS Applikation,
|
|
dbo.VertragselementApplikation.Bemerkung, dbo.VertragselementApplikation.Aktiv, dbo.VertragselementApplikation.Erstellt_am,
|
|
dbo.VertragselementApplikation.Mutiert_am, dbo.VertragselementApplikation.Mutierer, dbo.ApplikationVersion.Version
|
|
FROM dbo.VertragselementApplikation INNER JOIN
|
|
dbo.Vertragselement ON dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr LEFT OUTER JOIN
|
|
dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr
|
|
where dbo.vertragselement.VertragspartnerNr=@vertragspartnernr and
|
|
dbo.vertragselement.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and
|
|
dbo.vertragselementapplikation.aktiv=1 and dbo.Vertragstyp.AlsLizenz=1
|
|
order by dbo.applikation.bezeichnung
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_lizenz_vertragselement_applikation] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_lizenz_vertragselement_applikation]
|
|
@mitarbeiternr as integer,
|
|
@lizenznr as integer
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
SELECT dbo.VertragselementApplikation.VertragselementApplikationnr, dbo.Vertragspartner.VertragspartnerNr,
|
|
dbo.Vertragspartner.NameZ1 + ', ' + dbo.Vertragspartner.Ort AS Vertragspartner, dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Applikation.ApplikationNr,
|
|
dbo.Applikation.Bezeichnung AS Applikation, dbo.ApplikationVersion.ApplikationVersionNr, dbo.ApplikationVersion.Version, dbo.LizenzVertragselementApplikation.Aktiv,
|
|
dbo.LizenzVertragselementApplikation.Erstellt_am, dbo.LizenzVertragselementApplikation.Mutiert_am, dbo.LizenzVertragselementApplikation.Mutierer,
|
|
dbo.VertragselementApplikation.BezeichnungLizenverwaltung, dbo.LizenzVertragselementApplikation.Lizenznr,
|
|
dbo.LizenzVertragselementApplikation.LizenzVEApplNr, dbo.LizenzVertragselementApplikation.Bemerkung
|
|
into #tmp1
|
|
FROM dbo.VertragselementApplikation INNER JOIN
|
|
dbo.Vertragselement ON dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.LizenzVertragselementApplikation ON
|
|
dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.LizenzVertragselementApplikation.VertragselementApplikationNr LEFT OUTER JOIN
|
|
dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr
|
|
WHERE dbo.LizenzVertragselementApplikation.Lizenznr=@lizenznr
|
|
|
|
insert into #tmp1
|
|
SELECT dbo.VertragselementApplikation.VertragselementApplikationnr, 0 AS Vertragspartnernr, '' AS Vertragspartner, '' AS Vertragselement, dbo.Applikation.ApplikationNr,
|
|
dbo.Applikation.Bezeichnung AS Applikation, dbo.ApplikationVersion.ApplikationVersionNr, dbo.ApplikationVersion.Version,
|
|
dbo.LizenzVertragselementApplikation.Aktiv, dbo.LizenzVertragselementApplikation.Erstellt_am, dbo.LizenzVertragselementApplikation.Mutiert_am,
|
|
dbo.LizenzVertragselementApplikation.Mutierer, dbo.VertragselementApplikation.BezeichnungLizenverwaltung, dbo.LizenzVertragselementApplikation.Lizenznr,
|
|
dbo.LizenzVertragselementApplikation.LizenzVEApplNr,dbo.LizenzVertragselementApplikation.Bemerkung
|
|
FROM dbo.VertragselementApplikation INNER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.LizenzVertragselementApplikation ON
|
|
dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.LizenzVertragselementApplikation.VertragselementApplikationNr LEFT OUTER JOIN
|
|
dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr
|
|
WHERE (dbo.LizenzVertragselementApplikation.Lizenznr = @lizenznr) AND (dbo.VertragselementApplikation.Vertragselementnr = - 99)
|
|
|
|
select * from #tmp1
|
|
drop table #tmp1
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_lizenzkauf] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzkauf'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
Create PROCEDURE [dbo].[sp_get_lizenzkauf]
|
|
@Vertragselementnr int,
|
|
@Applikationnr int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
SELECT DISTINCT
|
|
dbo.Lizenzkauf.LizenzkaufNr, dbo.Lizenzkauf.Vertragselementapplikationnr, dbo.Lizenztyp.Bezeichnung AS Lizenztypnr, dbo.Lizenzkauf.Anzahl, dbo.Lizenzkauf.Kaufdatum,
|
|
dbo.Lizenzkauf.KGNummer, dbo.Lizenzkauf.SAPNummer, dbo.Lizenzkauf.Gueltigbis, dbo.Lizenzkauf.Statusnr, dbo.Lizenzkauf.Bemerkung, dbo.Lizenzkauf.Aktiv,
|
|
dbo.Lizenzkauf.Erstellt_am, dbo.Lizenzkauf.Mutiert_am, dbo.Lizenzkauf.Mutierer
|
|
FROM dbo.Lizenzkauf INNER JOIN
|
|
dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr INNER JOIN
|
|
dbo.VertragselementApplikation ON dbo.Lizenzkauf.vertragselementapplikationnr = dbo.VertragselementApplikation.vertragselementapplikationnr
|
|
WHERE (dbo.Lizenzkauf.vertragselementapplikationnr = @Vertragselementnr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_lizenzschluessel] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------------------
|
|
-- Stored procedure that will select all rows from the table 'Lizenzschluessel'
|
|
-- Returns: @iErrorCode int
|
|
---------------------------------------------------------------------------------
|
|
CREATE PROCEDURE [dbo].[sp_get_lizenzschluessel]
|
|
@lizenzkaufnr int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SET NOCOUNT ON
|
|
-- SELECT all rows from the table.
|
|
SELECT
|
|
[Lizenzschluesselnr],
|
|
[Lizenzkaufnr],
|
|
[Lizenzschluessel],
|
|
[Bemerkung],
|
|
[Aktiv],
|
|
[Erstellt_am],
|
|
[Mutiert_am],
|
|
[Mutierer]
|
|
FROM [dbo].[Lizenzschluessel]
|
|
where lizenzkaufnr=@lizenzkaufnr
|
|
ORDER BY
|
|
[Mutiert_am] desc
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_Lizenzstruktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <13.01.2008>
|
|
-- Description: <Auslesen der Struktur (inkl. Kategorien) der Applikationsverwaltung anhand eines Suchbegriffs>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_Lizenzstruktur]
|
|
@mitarbeiternr int,
|
|
@nuraktive int=0,
|
|
@alphasort int=0,
|
|
@applikationnr int=0,
|
|
@lizenztyp int=0
|
|
AS
|
|
|
|
CREATE TABLE #tmpd(
|
|
[Lizenznr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[aktiv] [bit] null,
|
|
[Strukturelement] bit null,
|
|
|
|
) ON [DEFAULT]
|
|
-- Rootentry für die Treeaufbereitung in der Applikation
|
|
insert #tmpd (lizenznr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
declare @liznr int
|
|
declare @lizbez varchar(50)
|
|
declare @lizprnt int
|
|
declare @anr int
|
|
declare @bez varchar(50)
|
|
declare @pid int
|
|
declare @snr int
|
|
declare @aktiv bit
|
|
declare @knr int
|
|
declare @st int
|
|
set @lizprnt = -1
|
|
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Erster Loop über die Applikationen, welche den entsprechenden Suchbegriff beinhalten
|
|
-----------------------------------------------------------------------------------------
|
|
SELECT DISTINCT dbo.Lizenz.LizenzNr, dbo.Lizenz.Bezeichnung, dbo.Lizenz.ParentID, dbo.Lizenz.SecurityLevelNr, dbo.Lizenz.Aktiv, dbo.Lizenz.Strukturelement
|
|
into #tmpx
|
|
from dbo.lizenz where lizenznr=-999999
|
|
|
|
if @applikationnr <> 0 begin
|
|
Insert #tmpx
|
|
SELECT DISTINCT dbo.Lizenz.LizenzNr, dbo.Lizenz.Bezeichnung, dbo.Lizenz.ParentID, dbo.Lizenz.SecurityLevelNr, dbo.Lizenz.Aktiv, dbo.Lizenz.Strukturelement
|
|
FROM dbo.VertragselementApplikation INNER JOIN
|
|
dbo.LizenzVertragselementApplikation ON
|
|
dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.LizenzVertragselementApplikation.VertragselementApplikationNr INNER JOIN
|
|
dbo.Lizenz ON dbo.LizenzVertragselementApplikation.Lizenznr = dbo.Lizenz.LizenzNr
|
|
WHERE (dbo.VertragselementApplikation.Applikationnr = @applikationnr) and dbo.Lizenz.SecurityLevelNr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
end else begin
|
|
insert #tmpx
|
|
SELECT DISTINCT dbo.Lizenz.lizenznr, dbo.lizenz.Bezeichnung, dbo.lizenz.ParentID, dbo.Lizenz.SecurityLevelNr, dbo.Lizenz.Aktiv, dbo.Lizenz.Strukturelement
|
|
FROM dbo.Lizenz
|
|
where dbo.Lizenz.SecurityLevelNr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
end
|
|
if @lizenztyp=2 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
if @lizenztyp=3 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
if @lizenztyp=4 begin
|
|
truncate table #tmpx
|
|
set @applikationnr=0
|
|
insert #tmpx select dbo.Lizenz.LizenzNr, dbo.Lizenz.Bezeichnung, dbo.Lizenz.ParentID, dbo.Lizenz.SecurityLevelNr, dbo.Lizenz.Aktiv, dbo.Lizenz.Strukturelement
|
|
from lizenz
|
|
where LizenzNr not in (select LizenzNr from LizenzVertragselementApplikation where Lizenznr>0) and dbo.Lizenz.SecurityLevelNr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and aktiv=1
|
|
end
|
|
|
|
declare xc cursor for
|
|
select * from #tmpx
|
|
open xc
|
|
fetch next from xc into @liznr, @lizbez, @pid, @snr, @aktiv ,@st
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(Lizenznr, bezeichnung, parentid, securitylevelnr, aktiv,Strukturelement)
|
|
values (@liznr, @lizbez, @pid, @snr, @aktiv,@st)
|
|
execute dbo.sp_get_Lizenzstruktur_up @Liznr,1
|
|
fetch next from xc into @Liznr, @Lizbez, @pid, @snr, @aktiv,@st
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
|
|
select * into #tmpxx from #tmpd
|
|
|
|
declare @rc int
|
|
select @rc=COUNT(*) from #tmpxx
|
|
if @applikationnr <> 0 and @rc > 0 begin
|
|
declare xc cursor for
|
|
select * from #tmpxx
|
|
open xc
|
|
fetch next from xc into @liznr, @lizbez, @pid, @snr, @aktiv ,@st
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(Lizenznr, bezeichnung, parentid, securitylevelnr, aktiv,Strukturelement)
|
|
values (@liznr, @lizbez, @pid, @snr, @aktiv,@st)
|
|
execute dbo.sp_get_Lizenzstruktur_down @Liznr,1
|
|
fetch next from xc into @Liznr, @Lizbez, @pid, @snr, @aktiv,@st
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
end
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Daten zurück geben und temporäre Tabelle löschen
|
|
-----------------------------------------------------------------------------------------
|
|
insert #tmpd (Lizenznr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
|
|
if @alphasort = 1 begin
|
|
update #tmpd set parentid=0 where parentid<0
|
|
delete from #tmpd where Lizenznr < 0
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct Lizenznr, bezeichnung, parentid, aktiv, strukturelement,'' as Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct Lizenznr, bezeichnung, parentid, aktiv, strukturelement,'' as Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
update #tmpd set strukturelement=0 where strukturelement is null
|
|
if @nuraktive=0 begin
|
|
select distinct Lizenznr, bezeichnung, parentid, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct Lizenznr, bezeichnung, parentid, aktiv, strukturelement from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_Lizenzstruktur_down] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_get_Lizenzstruktur_down]
|
|
@Root int,
|
|
@imandant int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
declare @xx varchar(255)
|
|
set @xx=''
|
|
declare @i int
|
|
while @i < @@NESTLEVEL begin
|
|
set @xx=@xx+"-"
|
|
end
|
|
|
|
declare @Lizid int, @bezeichnung varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit,@st int
|
|
select @bezeichnung=bezeichnung, @nr=Lizenznr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv,@st=strukturelement from Lizenz
|
|
where Lizenznr=@root
|
|
|
|
if @parent > 0 begin
|
|
insert into #tmpd (Lizenznr, bezeichnung, parentid, securitylevelnr, aktiv,strukturelement) values (@nr, @bezeichnung, @parent,@seclevel,@aktiv,@st)
|
|
end
|
|
|
|
set @Lizid=(select min (Lizenznr) from Lizenz where parentid=@root)
|
|
while @lizid is not null begin
|
|
exec dbo.sp_get_Lizenzstruktur_down 1, -1
|
|
set @lizid=(select min (Lizenznr) from dbo.Lizenz where parentid=@root and Lizenznr>@lizid)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_Lizenzstruktur_suche] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <13.01.2008>
|
|
-- Description: <Auslesen der Struktur (inkl. Kategorien) der Applikationsverwaltung anhand eines Suchbegriffs>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_Lizenzstruktur_suche]
|
|
@suchstring varchar(255),
|
|
@mitarbeiternr int,
|
|
@nuraktive int=0,
|
|
@alphasort int=0,
|
|
@suche int=0
|
|
AS
|
|
|
|
if @suchstring='' set @suche=0
|
|
CREATE TABLE #tmpx(
|
|
[Lizenznr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[aktiv] [bit] null,
|
|
[strukturelement] [bit] null,
|
|
[Treffer] [varchar] (1) null,
|
|
) ON [DEFAULT]
|
|
|
|
CREATE TABLE #tmpd(
|
|
[Lizenznr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[SecurityLevelNr] [int] null,
|
|
[aktiv] [bit] null,
|
|
[strukturelement] [bit] null,
|
|
[Treffer] [varchar] (1) null,
|
|
) ON [DEFAULT]
|
|
|
|
|
|
-- Rootentry für die Treeaufbereitung in der Applikation
|
|
insert #tmpd (Lizenznr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
declare @appnr int
|
|
declare @appbez varchar(50)
|
|
declare @appprnt int
|
|
declare @anr int
|
|
declare @bez varchar(50)
|
|
declare @pid int
|
|
declare @snr int
|
|
declare @aktiv bit
|
|
declare @knr int
|
|
declare @ste int
|
|
declare @ste1 int
|
|
set @appprnt = -1
|
|
-----------------------------------------------------------------------------------------
|
|
-- Erster Loop über die Applikationen, welche den entsprechenden Suchbegriff beinhalten
|
|
-----------------------------------------------------------------------------------------
|
|
set @suchstring='%' + @suchstring + '%'
|
|
insert #tmpx
|
|
SELECT DISTINCT
|
|
dbo.Lizenz.LizenzNr, dbo.Lizenz.Bezeichnung, dbo.Lizenz.ParentID, dbo.Lizenz.SecurityLevelNr, dbo.Lizenz.Aktiv, dbo.Lizenz.Strukturelement, '*' AS Treffer
|
|
FROM dbo.Lizenzschluessel FULL OUTER JOIN
|
|
dbo.Lizenzkauf FULL OUTER JOIN
|
|
dbo.LizenzVertragselementApplikation ON dbo.Lizenzkauf.Vertragselementapplikationnr = dbo.LizenzVertragselementApplikation.LizenzVEApplNr FULL OUTER JOIN
|
|
dbo.Vertragselement FULL OUTER JOIN
|
|
dbo.VertragselementApplikation FULL OUTER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr ON
|
|
dbo.Vertragselement.Vertragselementnr = dbo.VertragselementApplikation.Vertragselementnr ON
|
|
dbo.LizenzVertragselementApplikation.VertragselementApplikationNr = dbo.VertragselementApplikation.VertragselementApplikationnr FULL OUTER JOIN
|
|
dbo.Lizenz ON dbo.LizenzVertragselementApplikation.Lizenznr = dbo.Lizenz.LizenzNr ON dbo.Lizenzschluessel.Lizenzkaufnr = dbo.Lizenzkauf.LizenzkaufNr
|
|
|
|
WHERE (dbo.Lizenz.Bezeichnung LIKE @suchstring) OR
|
|
(dbo.LizenzVertragselementApplikation.Bemerkung LIKE @suchstring) OR
|
|
(dbo.Lizenz.Beschreibung LIKE @suchstring) OR
|
|
(dbo.VertragselementApplikation.Bemerkung LIKE @suchstring) OR
|
|
(dbo.Vertragselement.Bezeichnung LIKE @suchstring) OR
|
|
(dbo.Vertragselement.Beschreibung LIKE @suchstring) OR
|
|
(dbo.Lizenzkauf.KGNummer LIKE @suchstring) OR
|
|
(dbo.Lizenzkauf.SAPNummer LIKE @suchstring) OR
|
|
(dbo.Lizenzkauf.Bemerkung LIKE @suchstring) OR
|
|
(dbo.Applikation.Bezeichnung LIKE @suchstring) OR
|
|
(dbo.Lizenzschluessel.Lizenzschluessel LIKE @suchstring) OR
|
|
(dbo.Lizenzschluessel.Bemerkung LIKE @suchstring)
|
|
|
|
insert #tmpx SELECT DISTINCT
|
|
dbo.Lizenz.LizenzNr, dbo.Lizenz.Bezeichnung, dbo.Lizenz.ParentID, dbo.Lizenz.SecurityLevelNr, dbo.Lizenz.Aktiv, dbo.Lizenz.Strukturelement, '*' AS Treffer
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.VertragselementApplikation ON dbo.Vertragselement.Vertragselementnr = dbo.VertragselementApplikation.Vertragselementnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.Lizenz INNER JOIN
|
|
dbo.LizenzVertragselementApplikation ON dbo.Lizenz.LizenzNr = dbo.LizenzVertragselementApplikation.Lizenznr ON
|
|
dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.LizenzVertragselementApplikation.VertragselementApplikationNr
|
|
WHERE (dbo.Vertragselement.Bezeichnung LIKE @suchstring) OR
|
|
(dbo.Vertragspartner.NameZ1 LIKE @suchstring) OR
|
|
(dbo.Applikation.Bezeichnung LIKE @suchstring)
|
|
|
|
|
|
-- SELECT DISTINCT dbo.Lizenz.LizenzNr, dbo.Lizenz.Bezeichnung, dbo.Lizenz.ParentID, dbo.Lizenz.SecurityLevelNr, dbo.Lizenz.Aktiv, dbo.Lizenz.Strukturelement, '*' AS Treffer
|
|
--FROM dbo.Applikation INNER JOIN
|
|
-- dbo.VertragselementApplikation ON dbo.Applikation.ApplikationNr = dbo.VertragselementApplikation.Applikationnr INNER JOIN
|
|
-- dbo.Vertragspartner INNER JOIN
|
|
-- dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr ON
|
|
-- dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
-- dbo.LizenzVertragselementApplikation INNER JOIN
|
|
-- dbo.Lizenz ON dbo.LizenzVertragselementApplikation.Lizenznr = dbo.Lizenz.LizenzNr ON
|
|
-- dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.LizenzVertragselementApplikation.VertragselementApplikationNr
|
|
--WHERE dbo.lizenz.bezeichnung like @suchstring or dbo.lizenz.beschreibung like @suchstring or
|
|
-- dbo.Vertragselement.Bezeichnung like @suchstring or dbo.Applikation.Bezeichnung like @suchstring or dbo.Vertragspartner.NameZ1 like @suchstring
|
|
if @nuraktive=1 begin
|
|
delete from #tmpx where aktiv<>1
|
|
end
|
|
|
|
|
|
|
|
if @nuraktive=0 begin
|
|
delete from #tmpx where aktiv<>0
|
|
end
|
|
|
|
declare xc cursor for
|
|
|
|
select [lizenznr], [bezeichnung],[parentid],[SecurityLevelNr],[aktiv], strukturelement from #tmpx
|
|
|
|
open xc
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv, @ste
|
|
while @@fetch_status=0 begin
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Zweiter Loop über die Einträge der obesten Ebene der Lizenzen
|
|
-----------------------------------------------------------------------------------------
|
|
declare yc cursor for
|
|
select lizenznr, bezeichnung, parentid, securitylevelnr, aktiv, strukturelement from lizenz
|
|
where Lizenznr=@appnr
|
|
open yc
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @aktiv , @ste1
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd(Lizenznr, bezeichnung, parentid, securitylevelnr, aktiv, strukturelement)
|
|
values (@anr, @bez, @appprnt, @snr, @aktiv,@ste1)
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Je Applikation die untergeordneten Applikationen/Module auslesen
|
|
-----------------------------------------------------------------------------------------
|
|
--execute dbo.sp_get_applstruktur_down @anr,1, @anr
|
|
execute dbo.sp_get_lizenzstruktur_up @anr,1
|
|
|
|
fetch next from yc into @anr, @bez, @pid, @snr, @aktiv , @ste1
|
|
end
|
|
close yc
|
|
deallocate yc
|
|
|
|
set @appprnt = @appprnt - 1
|
|
fetch next from xc into @appnr, @appbez, @pid, @snr, @aktiv, @ste
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
|
|
-----------------------------------------------------------------------------------------
|
|
-- Daten zurück geben und temporäre Tabelle löschen
|
|
-----------------------------------------------------------------------------------------
|
|
delete from #tmpd where Lizenznr is null
|
|
|
|
insert #tmpd (lizenznr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
--update #tmpd set strukturelement=0
|
|
delete from #tmpd where parentid<0
|
|
|
|
|
|
if @alphasort = 1 begin
|
|
update #tmpd set parentid=0 where parentid<0
|
|
delete from #tmpd where Lizenznr < 0
|
|
|
|
if @suche=1 begin
|
|
update #tmpd set treffer='*' where [lizenznr] in (select [Lizenznr] from #tmpx)
|
|
if @nuraktive=0 begin
|
|
select distinct lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct Lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end else begin
|
|
select distinct lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd where ltrim(bezeichnung) <> '' order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
if @suche=1 begin
|
|
update #tmpd set treffer='*' where lizenznr in (select lizenznr from #tmpx)
|
|
if @nuraktive=0 begin
|
|
select distinct lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd order by bezeichnung
|
|
end else begin
|
|
select distinct lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd order by bezeichnung
|
|
end
|
|
drop table #tmpd
|
|
return
|
|
end
|
|
|
|
if @nuraktive=0 begin
|
|
select distinct lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd order by bezeichnung
|
|
end else begin
|
|
select distinct lizenznr, bezeichnung, parentid, aktiv, strukturelement,Treffer from #tmpd order by bezeichnung
|
|
-- select distinct applikationsnr, bezeichnung, parentid, lic, aktiv from #tmpd where aktiv=1 order by bezeichnung
|
|
end
|
|
|
|
|
|
drop table #tmpd
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_Lizenzstruktur_up] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_get_Lizenzstruktur_up]
|
|
@Root int,
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
declare @xx varchar(255)
|
|
|
|
declare @Lizid int, @bezeichnung varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit,@st int
|
|
|
|
select @bezeichnung=bezeichnung, @nr=Lizenznr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv,@st=strukturelement from Lizenz
|
|
where Lizenznr=@root
|
|
|
|
insert into #tmpd (Lizenznr, bezeichnung, parentid, securitylevelnr, aktiv,strukturelement) values (@nr, @bezeichnung, @parent,@seclevel,@aktiv,@st)
|
|
|
|
set @Lizid=(select parentid from lizenz where lizenznr=@nr)
|
|
|
|
while @Lizid is not null begin
|
|
exec dbo.sp_get_Lizenzstruktur_up @Lizid, 1
|
|
set @Lizid=(select parentid from dbo.Lizenz
|
|
where Lizenznr = @nr and parentid>@Lizid)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_Lizenzverbindungen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
create PROCEDURE [dbo].[sp_get_Lizenzverbindungen]
|
|
@mitarbeiternr int,
|
|
@vertragselementapplikationnr int
|
|
as
|
|
BEGIN
|
|
if @vertragselementapplikationnr>0 begin
|
|
select * from LizenzVertragselementApplikation where Aktiv=1 and VertragselementApplikationNr=@vertragselementapplikationnr
|
|
end
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_lizenzvertragselemente] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_lizenzvertragselemente]
|
|
@Vertragspartnernr int,
|
|
@Mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
SELECT dbo.Vertragselement.Vertragselementnr, dbo.Vertragselement.Bezeichnung, dbo.Vertragselement.Aktiv
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
WHERE (dbo.Vertragstyp.AlsLizenz = 1) and dbo.Vertragselement.VertragspartnerNr=@Vertragspartnernr
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_ma_profile] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Hutter Stefa >
|
|
-- Create date: <2.12.2008>
|
|
-- Description: <Aktive Profile des Mitarbeiters auslesen>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_ma_profile]
|
|
@mitarbeiternr int
|
|
AS
|
|
|
|
select * from profil where mitarbeiternr=@mitarbeiternr and aktiv=1
|
|
order by standard desc, aktiv desc, bezeichnung asc
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_madetails] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_madetails] @manr INT
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
SELECT dbo.MADetails.MADetailNr, dbo.MitarbeiterTyp.MitarbeiterTypNr, dbo.MitarbeiterTyp.Bezeichnung, dbo.MitarbeiterTyp.Fuehrungsanteil, dbo.OE.OeNr,
|
|
dbo.OE.Bezeichnung AS Expr1, dbo.MADetails.Engagement, dbo.MADetails.Gueltig_ab, dbo.MADetails.Bemerkung, dbo.MADetails.Aktiv,
|
|
dbo.MADetails.Erstellt_am, dbo.MADetails.Mutiert_am, dbo.MADetails.Mutierer,dbo.MADetails.Individuelle_Reduktion,
|
|
dbo.MADetails.Individuelle_Reduktion_Bemerkung, dbo.MADetails.Planwert_Anteil_RTB_Person
|
|
FROM dbo.MADetails
|
|
INNER JOIN dbo.MitarbeiterTyp ON dbo.MADetails.MitarbeiterTypNr = dbo.MitarbeiterTyp.MitarbeiterTypNr
|
|
INNER JOIN dbo.OE ON dbo.MADetails.OENr = dbo.OE.OeNr
|
|
WHERE dbo.MADetails.MANr = @manr
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_set_server_applikation] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_set_server_applikation]
|
|
@serverapplnr INT = 0 ,
|
|
@servernr INT = 0 ,
|
|
@applnr INT = 0 ,
|
|
@bemerkung VARCHAR(1024) = '' ,
|
|
@mitarbeiternr INT = 0 ,
|
|
@fnkt INT
|
|
AS
|
|
BEGIN
|
|
|
|
DECLARE @tbl TABLE
|
|
(
|
|
Mainkey INTEGER ,
|
|
Parentid INTEGER ,
|
|
bezeichnung VARCHAR(255) ,
|
|
imageindex INTEGER
|
|
)
|
|
|
|
|
|
IF @fnkt = 1 -- Daten auslesen Server->Appl
|
|
BEGIN
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.Applikation.ApplikationNr ,
|
|
dbo.Applikation.Bezeichnung ,
|
|
dbo.Server_Applikation.ServerNr
|
|
,CASE WHEN server_applikation.aktiv=1 THEN 0 ELSE 1 end AS imageindex
|
|
FROM dbo.Applikation
|
|
INNER JOIN dbo.Server_Applikation ON dbo.Applikation.ApplikationNr = dbo.Server_Applikation.Applikationnr
|
|
WHERE server_applikation.servernr = @servernr
|
|
--AND server_applikation.aktiv = 1
|
|
ORDER BY Bezeichnung
|
|
|
|
END
|
|
IF @fnkt = 2
|
|
BEGIN
|
|
INSERT INTO [dbo].[Server_Applikation]
|
|
( [ServerNr] ,
|
|
[Applikationnr] ,
|
|
[Bemerkung] ,
|
|
[Aktiv] ,
|
|
[erstellt_am] ,
|
|
[mutiert_am] ,
|
|
[mutierer]
|
|
)
|
|
VALUES ( @servernr ,
|
|
@applnr ,
|
|
'' ,
|
|
1 ,
|
|
GETDATE() ,
|
|
GETDATE() ,
|
|
@mitarbeiternr
|
|
)
|
|
END
|
|
IF @fnkt = 3 -- Daten auslesen Server->Appl
|
|
BEGIN
|
|
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex
|
|
)
|
|
VALUES ( 0 ,
|
|
NULL ,
|
|
'Root' ,
|
|
1
|
|
)
|
|
|
|
--Umgebung
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex
|
|
)
|
|
SELECT DISTINCT
|
|
dbo.Server_Umgebung.Server_UmgebungNr * 100000 AS MainKey ,
|
|
0 AS Parentid ,
|
|
dbo.Server_Umgebung.Bezeichnung ,
|
|
0 AS ImageIndex
|
|
FROM dbo.Server_Inventar
|
|
INNER JOIN dbo.Server_Umgebung ON dbo.Server_Inventar.Server_UmgebungNr = dbo.Server_Umgebung.Server_UmgebungNr
|
|
INNER JOIN dbo.Server_Applikation ON dbo.Server_Inventar.ServerInventarNr = dbo.Server_Applikation.ServerNr
|
|
WHERE ( dbo.Server_Applikation.Applikationnr = @applnr )
|
|
AND ( dbo.Server_Applikation.Aktiv = 1 )
|
|
|
|
-- Server-Kategorie
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex
|
|
)
|
|
SELECT DISTINCT
|
|
dbo.Server_Kategorie.Server_KategorieNr
|
|
* 110000
|
|
+ dbo.Server_Inventar.Server_UmgebungNr AS MainKey ,
|
|
dbo.Server_Inventar.Server_UmgebungNr * 100000 AS Expr1 ,
|
|
dbo.Server_Kategorie.Bezeichnung ,
|
|
1 AS ImageIndex
|
|
FROM dbo.Server_Inventar
|
|
INNER JOIN dbo.Server_Kategorie ON dbo.Server_Inventar.Server_KategorieNr = dbo.Server_Kategorie.Server_KategorieNr
|
|
INNER JOIN dbo.Server_Applikation ON dbo.Server_Inventar.ServerInventarNr = dbo.Server_Applikation.ServerNr
|
|
WHERE ( dbo.Server_Applikation.Applikationnr = @applnr )
|
|
AND ( dbo.Server_Applikation.Aktiv = 1 )
|
|
|
|
|
|
-- Server
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex
|
|
)
|
|
SELECT DISTINCT
|
|
dbo.Server_Inventar.ServerInventarNr AS MainKey ,
|
|
dbo.Server_Inventar.Server_KategorieNr
|
|
* 110000
|
|
+ dbo.Server_Inventar.Server_UmgebungNr AS ParentID ,
|
|
dbo.Server_Inventar.Bezeichnung ,
|
|
CASE WHEN dbo.Server_Inventar.aktiv=1 THEN 2 ELSE 4 end AS imageindex
|
|
FROM dbo.Server_Inventar
|
|
INNER JOIN dbo.Server_Applikation ON dbo.Server_Inventar.ServerInventarNr = dbo.Server_Applikation.ServerNr
|
|
WHERE --( dbo.Server_Inventar.Aktiv = 1 )
|
|
--AND
|
|
( dbo.Server_Applikation.Applikationnr = @applnr )
|
|
AND ( dbo.Server_Applikation.Aktiv = 1 )
|
|
SELECT *
|
|
FROM @tbl
|
|
RETURN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.Server_Inventar.ServerInventarNr ,
|
|
dbo.Server_Inventar.Bezeichnung AS Bezeichnung ,
|
|
dbo.Server_Applikation.Applikationnr
|
|
FROM dbo.Server_Applikation
|
|
INNER JOIN dbo.Server_Inventar ON dbo.Server_Applikation.ServerNr = dbo.Server_Inventar.ServerInventarNr
|
|
WHERE ( dbo.Server_Applikation.Applikationnr = @applnr )
|
|
AND server_applikation.aktiv = 1
|
|
ORDER BY Bezeichnung
|
|
|
|
END
|
|
|
|
IF @fnkt = 4
|
|
BEGIN
|
|
UPDATE dbo.Server_Applikation
|
|
SET aktiv = 0 ,
|
|
mutierer = @mitarbeiternr ,
|
|
mutiert_am = GETDATE()
|
|
WHERE servernr = @servernr
|
|
AND Applikationnr = @applnr
|
|
AND aktiv = 1
|
|
|
|
END
|
|
IF @fnkt = 5
|
|
BEGIN
|
|
UPDATE dbo.Server_Applikation
|
|
SET aktiv = 0 ,
|
|
mutierer = @mitarbeiternr ,
|
|
mutiert_am = GETDATE()
|
|
WHERE servernr = @servernr
|
|
AND aktiv = 1
|
|
END
|
|
|
|
IF @fnkt=6 BEGIN
|
|
UPDATE dbo.Server_Applikation
|
|
SET aktiv = 1 ,
|
|
mutierer = @mitarbeiternr ,
|
|
mutiert_am = GETDATE()
|
|
WHERE Server_ApplikationNr=@serverapplnr
|
|
end
|
|
|
|
if @fnkt=7 begin
|
|
select count(*) from server_applikation
|
|
where applikationnr=@applnr and servernr=@servernr and aktiv=1
|
|
end
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_stammdaten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: Stefan Hutter
|
|
-- Create date: 14.4.2009
|
|
-- Description: Liest die Stammdatentabellen
|
|
-- Changelog:
|
|
-- 15.4.09 Anpassung, dass nur die aktiven Datenelemente ausgelesen werden
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_stammdaten]
|
|
@mitarbeiternr int,
|
|
@tabelle varchar(255),
|
|
@orderby varchar(255)
|
|
as
|
|
begin
|
|
declare @xsql varchar(255)
|
|
if upper(@tabelle)='KOSTENART' begin
|
|
select kostenartnr, bezeichnung + ' - ' + beschreibung as Bezeichnung from kostenart where aktiv=1 order by bezeichnung
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='KONTAKTTYP_GREMIUM' begin
|
|
select kontakttypnr, bezeichnung, ApplikationsbereichNr from kontakttyp where applikationsbereichnr=3 and aktiv=1 order by bezeichnung
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='RELEASEART' begin
|
|
select Releaseartnr, bezeichnung as Bezeichnung from Releaseart where aktiv=1 order by bezeichnung
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='PERSON' begin
|
|
select personnr, Name +' '+Vorname as Bezeichnung from Person where Vertragspartnernr=1 and Aktiv=1 order by Name, Vorname
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='PERSON1' begin
|
|
select personnr, Name +' '+Vorname as Bezeichnung from Person where Vertragspartnernr=1 and Aktiv=1 order by Name, Vorname
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='PERSON2' begin
|
|
select personnr, Name +' '+Vorname as Bezeichnung from Person where Vertragspartnernr=1 and Aktiv=1 order by Name, Vorname
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='INSTALLATIONTYP' begin
|
|
SELECT * from installationtyp ORDER BY sort
|
|
return
|
|
end
|
|
|
|
|
|
set @xsql='Select * from ' + @tabelle + ' where aktiv=1 order by ' + @orderby
|
|
exec(@xsql)
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_struktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_struktur] @per DATETIME
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
SELECT 'OE_' + LTRIM(RTRIM(STR(OeNr))) AS ID, 'OE_' + LTRIM(RTRIM(STR(ParentId))) AS ParentID, Bezeichnung, 0 AS ImageIndex,
|
|
Beschreibung AS ErweiterteSuche, sortierung AS sort
|
|
INTO #tmp1
|
|
FROM dbo.OE WHERE aktiv=1
|
|
ORDER BY Sortierung
|
|
|
|
|
|
INSERT #tmp1 ( id, parentid, bezeichnung, imageindex, ErweiterteSuche, sort )
|
|
VALUES ( 'OE_0', NULL, 'Root', 0, ' ',1 )
|
|
|
|
INSERT #tmp1
|
|
SELECT 'MA_' + LTRIM(RTRIM(STR(dbo.MA.MANr))) AS ID, 'OE_-1' AS ParentID,
|
|
dbo.MA.Name + ' ' + dbo.MA.Vorname AS Bezeichnung, 1 AS ImageIndex, dbo.MA.Name + ' ' + dbo.MA.Vorname AS ErweiterteSuche, 0 AS sort
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE ma.aktiv=1 AND dbo.ma.manr NOT IN ( SELECT manr
|
|
FROM dbo.MADetails
|
|
WHERE aktiv = 1 )
|
|
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1 AND gueltig_bis >=@per
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr AND aktiv=1
|
|
AND Gueltig_ab <= @per
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
INSERT #tmp1
|
|
SELECT TOP 1
|
|
'MA_' + LTRIM(RTRIM(STR(dbo.MA.MANr))) AS ID,
|
|
'OE_' + ISNULL(LTRIM(RTRIM(STR(dbo.MADetails.OENr))), '-1') AS ParentID,
|
|
+dbo.MA.Name + ' ' + dbo.MA.Vorname AS Bezeichnung, 1 AS ImageIndex,
|
|
dbo.MA.Name + ' ' + dbo.MA.Vorname AS ErweiterteSuche, dbo.ma.sortierung AS sort
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr AND dbo.MADetails.Aktiv=1
|
|
AND Gueltig_ab <= @per
|
|
ORDER BY Gueltig_ab desc
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
|
|
SELECT *
|
|
FROM #tmp1
|
|
ORDER BY parentid,sort, Bezeichnung
|
|
|
|
DROP TABLE #tmp1
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_struktur_oe] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_struktur_oe] @per DATETIME
|
|
AS
|
|
BEGIN
|
|
SELECT oenr AS id, parentid, bezeichnung, 0 AS imageindex, beschreibung AS ErweiterteSuche, sortierung AS Sort
|
|
into #tmp2
|
|
FROM dbo.OE where aktiv=1
|
|
|
|
INSERT #tmp2 ( id, parentid, bezeichnung, imageindex, ErweiterteSuche, sort )
|
|
VALUES ( '0', NULL, 'Root', 0, ' ',1 )
|
|
SELECT * FROM #tmp2 ORDER BY parentid,sort, Bezeichnung
|
|
DROP TABLE #tmp2
|
|
|
|
return
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_sysadmin_hierarchie_data] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_get_sysadmin_hierarchie_data]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Root int,
|
|
@isprache int,
|
|
@imandant int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON
|
|
DECLARE @DokID int, @Dokname varchar(30), @nr int, @pa int, @sort int, @i1 int, @i2 int
|
|
SET @DokName = (SELECT Bezeichnung FROM dbo.sysadminfunktion WHERE sysadminfnktnr = @Root and sprache=@isprache and mandantnr=@imandant)
|
|
set @nr = (SELECT sysadminfnktnr FROM dbo.sysadminfunktion WHERE sysadminfnktnr = @Root and sprache=@isprache and mandantnr=@imandant)
|
|
set @pa = (SELECT parentid FROM dbo.sysadminfunktion WHERE sysadminfnktnr = @Root and sprache=@isprache and mandantnr=@imandant)
|
|
set @sort = (SELECT isnull(sort,0) FROM dbo.sysadminfunktion WHERE sysadminfnktnr = @Root and sprache=@isprache and mandantnr=@imandant)
|
|
set @i1 = (SELECT imageindex FROM dbo.sysadminfunktion WHERE sysadminfnktnr = @Root and sprache=@isprache and mandantnr=@imandant)
|
|
set @i2 = (SELECT imageindexopen FROM dbo.sysadminfunktion WHERE sysadminfnktnr = @Root and sprache=@isprache and mandantnr=@imandant)
|
|
|
|
PRINT str(@nr) + ' ' + @Dokname
|
|
|
|
insert into #tmph (sysadminfnktnr, Bezeichnung, imageindex,imageindexopen, parentid,sort) values(@nr,@dokname,@i1,@i2,@pa,@sort)
|
|
|
|
SET @DokID = (SELECT (parentid) FROM dbo.sysadminfunktion WHERE sysadminfnktnr=@nr)
|
|
WHILE (@dokid IS NOT NULL) and (@dokid<>0)
|
|
BEGIN
|
|
EXEC sp_get_sysadmin_hierarchie_data @DOkid, @isprache, @imandant
|
|
SET @DokID = (SELECT (parentid) FROM dbo.sysadminfunktion WHERE sysadminfnktnr=@nr AND parentid > @dokID)
|
|
END
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_sysadmin_tree] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_get_sysadmin_tree]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------------------------------------
|
|
-- Liest die Dokumentart-Hierarchie, Knoten Root in der entsprechenden Sprache, für den entsprechenden Mandanten
|
|
--
|
|
-- Autor: Stefan Hutter
|
|
--------------------------------------------------------------
|
|
@imitarbeiternr int,
|
|
@iSprache int,
|
|
@iMandant int,
|
|
@iRoot int,
|
|
@iErrorcode int output
|
|
AS
|
|
CREATE TABLE #tmph(
|
|
[sysadminfnktnr] [int] NULL ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[imageindex] [int] NULL ,
|
|
[imageindexopen] [int] NULL,
|
|
[parentid] [int] null,
|
|
[sort] [int] null
|
|
) ON [DEFAULT]
|
|
declare @sfnkt int
|
|
declare xcursor cursor for
|
|
SELECT dbo.rolle_sysadminfunktion.sysadminfnktnr
|
|
FROM dbo.mitarbeiter_funktionsgruppe INNER JOIN
|
|
dbo.funktionsgruppe_rolle ON dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr = dbo.funktionsgruppe_rolle.funktionsgruppenr INNER JOIN
|
|
dbo.rolle_sysadminfunktion ON dbo.funktionsgruppe_rolle.rollenr = dbo.rolle_sysadminfunktion.rollenr INNER JOIN
|
|
dbo.funktionsgruppe ON dbo.mitarbeiter_funktionsgruppe.funktionsgruppenr = dbo.funktionsgruppe.funktionsgruppenr
|
|
WHERE (dbo.rolle_sysadminfunktion.aktiv = 1) AND (dbo.funktionsgruppe_rolle.aktiv = 1) AND (dbo.mitarbeiter_funktionsgruppe.aktiv = 1) AND
|
|
(dbo.funktionsgruppe.aktiv = 1) AND (dbo.mitarbeiter_funktionsgruppe.mitarbeiternr = @imitarbeiternr)
|
|
/*
|
|
SELECT dbo.rolle_sysadminfunktion.sysadminfnktnr
|
|
FROM dbo.rolle INNER JOIN
|
|
dbo.mitarbeiterrolle ON dbo.rolle.rollenr = dbo.mitarbeiterrolle.rollenr INNER JOIN
|
|
dbo.rolle_sysadminfunktion ON dbo.rolle.rollenr = dbo.rolle_sysadminfunktion.rollenr
|
|
WHERE dbo.mitarbeiterrolle.mitarbeiternr = @imitarbeiternr and
|
|
rolle_sysadminfunktion.aktiv=1 and
|
|
dbo.rolle.aktiv=1 and
|
|
dbo.mitarbeiterrolle.aktiv=1
|
|
*/
|
|
|
|
open xcursor
|
|
FETCH NEXT FROM xcursor into @sfnkt
|
|
WHILE @@FETCH_STATUS = 0 BEGIN
|
|
execute sp_get_sysadmin_hierarchie_data @sfnkt, @isprache, @imandant
|
|
FETCH NEXT FROM xcursor into @sfnkt
|
|
end
|
|
close xcursor
|
|
deallocate xcursor
|
|
|
|
delete #tmph where parentid is null
|
|
update #tmph set parentid=0, imageindex=2, imageindexopen=2 where sysadminfnktnr=@iroot
|
|
select distinct * from #tmph order by sort
|
|
drop table #tmph
|
|
select @iErrorcode=@@error
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_TabControlMultiline] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_TabControlMultiline]
|
|
@tabcontrolname varchar(255),
|
|
@multiline int output
|
|
AS
|
|
BEGIN
|
|
select @multiline=isnull(multiline,0) from TabControlMultiline where TabControlName=@tabcontrolname and Aktiv=1
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_versionen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_versionen]
|
|
@applikationnr int,
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
select * from ApplikationVersion where applikationnr=@applikationnr and aktiv=1 order by Version
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_vertragselement_applikation] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[sp_get_vertragselement_applikation]
|
|
@KeyValue int,
|
|
@mitarbeiternr int
|
|
AS
|
|
SELECT dbo.VertragselementApplikation.VertragselementApplikationnr,
|
|
dbo.VertragselementApplikation.Vertragselementnr,
|
|
dbo.VertragselementApplikation.Applikationnr,
|
|
dbo.Vertragselement.Bezeichnung as Vertragselement, dbo.Applikation.Bezeichnung AS Applikation,
|
|
dbo.VertragselementApplikation.Bemerkung, dbo.VertragselementApplikation.Aktiv,
|
|
dbo.VertragselementApplikation.Erstellt_am, dbo.VertragselementApplikation.Mutiert_am,
|
|
dbo.VertragselementApplikation.Mutierer
|
|
into #tmp1
|
|
FROM dbo.VertragselementApplikation INNER JOIN
|
|
dbo.Vertragselement ON dbo.VertragselementApplikation.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr
|
|
where dbo.vertragselementapplikation.applikationnr=@keyvalue and
|
|
dbo.vertragselement.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) and
|
|
dbo.vertragselementapplikation.aktiv=1
|
|
order by dbo.applikation.bezeichnung
|
|
|
|
|
|
insert into #tmp1
|
|
SELECT - 99 AS vertragselementapplikationsnr, dbo.Vertragselement.Vertragselementnr, dbo.Applikation.ApplikationNr, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Applikation.Bezeichnung AS Applikation, 'Lizenzelemnt' AS bemekrung, 1 AS aktiv, dbo.Vertragselement.Erstellt_am, dbo.Vertragselement.Mutiert_am,
|
|
dbo.Vertragselement.Mutierer
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Applikation ON dbo.Vertragselement.ApplikationNr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
WHERE (dbo.Vertragselement.Aktiv = 1) AND (dbo.Vertragstyp.AlsLizenz = 1) and
|
|
dbo.vertragselement.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and dbo.applikation.applikationnr=@keyvalue
|
|
|
|
-- Get the Error Code for the statement just executed.
|
|
|
|
select distinct * from #tmp1 where VertragselementApplikationnr >-1
|
|
drop table #tmp1
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_vertragsparnter] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <09.03.2009>
|
|
-- Description: <Liefert eine Liste der Vertragspartner>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_get_vertragsparnter]
|
|
@mitarbeiternr int,
|
|
@suchstring varchar(255)
|
|
as
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
set @suchstring='%'+@suchstring+'%'
|
|
select VertragspartnerNr ,NameZ1 + ' ' + NameZ2 + ', ' + PLZ + ' ' + Ort AS Description, aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr<= dbo.get_securitylevel(@mitarbeiternr) and
|
|
(namez1 like @suchstring or namez2 like @suchstring or ort like @suchstring)
|
|
order by namez1,namez2, ort
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_get_vertragspartner] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <09.03.2009>
|
|
-- Description: <Liefert eine Liste der Vertragspartner>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_get_vertragspartner]
|
|
@mitarbeiternr int,
|
|
@suchstring varchar(255)
|
|
as
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
set @suchstring='%'+@suchstring+'%'
|
|
select VertragspartnerNr ,NameZ1 + ' ' + NameZ2 + ', ' + PLZ + ' ' + Ort AS Description, aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and
|
|
(namez1 like @suchstring or namez2 like @suchstring or ort like @suchstring)
|
|
order by namez1,namez2, ort
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_keyuser_massenupdate] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_keyuser_massenupdate]
|
|
@fnkt int,
|
|
@kontakttypnr int,
|
|
@usernr int,
|
|
@usernrneu int=0,
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
-- Bestehende KeyUser auslesen
|
|
if @fnkt=0 begin
|
|
SELECT distinct dbo.Person.PersonNr, dbo.Person.Name + ' ' + dbo.Person.Vorname AS Mitarbeiter
|
|
FROM dbo.person
|
|
WHERE (dbo.person.aktiv = 1) and dbo.person.vertragspartnernr=1
|
|
ORDER BY mitarbeiter
|
|
end
|
|
|
|
if @fnkt=1 begin
|
|
SELECT DISTINCT dbo.Kontakttyp.KontakttypNr, dbo.Kontakttyp.Bezeichnung
|
|
FROM dbo.ApplikationKontakt INNER JOIN
|
|
dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr
|
|
WHERE (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.Aktiv = 1)
|
|
order by bezeichnung
|
|
end
|
|
|
|
-- mögliche KeyUser auslesen
|
|
if @fnkt=2 begin
|
|
SELECT distinct dbo.Person.PersonNr, dbo.Person.Name + ' ' + dbo.Person.Vorname AS Mitarbeiter
|
|
FROM dbo.ApplikationKontakt INNER JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr
|
|
WHERE (dbo.ApplikationKontakt.KontakttypNr = @kontakttypnr) and dbo.applikationkontakt.aktiv=1
|
|
ORDER BY mitarbeiter
|
|
end
|
|
|
|
-- Applikationen auflisten
|
|
if @fnkt=3 begin
|
|
SELECT dbo.Applikation.Bezeichnung
|
|
FROM dbo.ApplikationKontakt INNER JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN
|
|
dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr
|
|
WHERE (dbo.ApplikationKontakt.personnr=@usernr) and (dbo.ApplikationKontakt.kontakttypnr=@kontakttypnr)
|
|
AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Applikation.Aktiv = 1)
|
|
end
|
|
|
|
if @fnkt=4 begin
|
|
declare @anr int
|
|
declare @apnr int
|
|
declare @newkey int
|
|
declare @ec int
|
|
select applikationkontaktnr, applikationnr
|
|
into #tmpa from applikationkontakt
|
|
where aktiv=1 and kontakttypnr=@kontakttypnr and personnr=@usernr
|
|
declare xc cursor for
|
|
select * from #tmpa
|
|
open xc
|
|
fetch next from xc into @anr, @apnr
|
|
while @@fetch_status=0 begin
|
|
update applikationkontakt set aktiv=0, mutiert_am=getdate(), mutierer=@mitarbeiternr where applikationkontaktnr=@anr
|
|
execute sp_get_dbkey 'ApplikationKontakt',@newkey output, @ec output
|
|
insert applikationkontakt (applikationkontaktnr, applikationnr, personnr, kontakttypnr,intern, bemerkung, aktiv,
|
|
erstellt_am, mutiert_am, mutierer, mandantnr, securitylevelnr)
|
|
values (@newkey,@apnr,@usernrneu,@kontakttypnr,0,'',1,getdate(),getdate(),@mitarbeiternr,null,0)
|
|
fetch next from xc into @anr, @apnr
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
drop table #tmpa
|
|
end
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lc_check_delete] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lc_check_delete]
|
|
@lc_produktnr INT,
|
|
@fnkt int
|
|
AS
|
|
BEGIN
|
|
IF @fnkt=1 begin
|
|
SELECT * FROM dbo.LC_Produkt WHERE Abgeloest_durch_produktnr=@lc_produktnr AND aktiv=1 ORDER BY Bezeichnung
|
|
END
|
|
IF @fnkt=2 BEGIN
|
|
SELECT * FROM dbo.LC_Produkt WHERE LC_ProduktNr_Parent=@lc_produktnr AND aktiv=1 AND IstStruktur=0 ORDER BY Bezeichnung
|
|
|
|
END
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lc_get_kopien] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lc_get_kopien]
|
|
@original INT,
|
|
@fnkt INT = 0,
|
|
@result INT=0 output
|
|
AS
|
|
BEGIN
|
|
DECLARE @t1 TABLE(copykey INT, parentnr int, bezeichnung VARCHAR(1024))
|
|
DECLARE @bez VARCHAR(255)
|
|
|
|
SELECT @bez=bezeichnung FROM dbo.LC_Produkt WHERE LC_ProduktNr=@original
|
|
INSERT @t1 SELECT lc_produkt_copynr, lc_produkt_parentnr, @bez FROM dbo.LC_Produkt_Copy WHERE aktiv=1 AND lc_produktnr=@original
|
|
|
|
declare @lcnr int
|
|
DECLARE @pnr INT
|
|
DECLARE @p1 INT
|
|
DECLARE @b1 VARCHAR(255)
|
|
DECLARE @i int
|
|
DECLARE xc CURSOR FOR
|
|
SELECT * FROM @t1
|
|
OPEN xc
|
|
FETCH NEXT FROM xc into @lcnr, @pnr, @bez
|
|
WHILE @@fetch_status=0 BEGIN
|
|
SET @i=1
|
|
SET @p1=@pnr
|
|
WHILE @i=1 BEGIN
|
|
SELECT @b1=bezeichnung,@p1=lc_produktnr_parent FROM lc_produkt WHERE lc_produktnr=@p1
|
|
IF @@rowcount=0 BEGIN
|
|
SET @i=0
|
|
END ELSE BEGIN
|
|
SET @bez=@b1+' / ' + @bez
|
|
END
|
|
END
|
|
UPDATE @t1 SET bezeichnung=@bez WHERE copykey=@lcnr
|
|
|
|
|
|
FETCH NEXT FROM xc into @lcnr, @pnr, @bez
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
IF @fnkt=1 BEGIN
|
|
SELECT @result=COUNT(*) FROM @t1
|
|
END ELSE begin
|
|
SELECT copykey, parentnr, bezeichnung as Element FROM @t1
|
|
END
|
|
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lc_get_produkte] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lc_get_produkte]
|
|
AS
|
|
BEGIN
|
|
DECLARE @tmp1 TABLE
|
|
(
|
|
id INT ,
|
|
parentid INT ,
|
|
bezeichnung VARCHAR(255) ,
|
|
imageindex INT ,
|
|
beschreibung VARCHAR(1024) ,
|
|
IstStruktur BIT ,
|
|
verweisnr INT ,
|
|
copy INT ,
|
|
originalid INT,
|
|
Produkttypnr int,
|
|
Eingesetzt int
|
|
)
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
|
|
INSERT @tmp1
|
|
SELECT lc_produktnr AS id ,
|
|
lc_produktnr_parent AS parentid ,
|
|
bezeichnung ,
|
|
imageindex AS imageindex ,
|
|
ISNULL(Beschreibung, '') AS Beschreibung ,
|
|
IstStruktur ,
|
|
ISNULL(verweisnr, 0) AS Verweisnr ,
|
|
0 AS copy ,
|
|
LC_ProduktNr,
|
|
ProdukttypNr, StatusNr
|
|
FROM dbo.LC_Produkt
|
|
WHERE aktiv = 1 AND IstStruktur=0
|
|
|
|
|
|
|
|
END
|
|
|
|
SELECT *
|
|
FROM @tmp1
|
|
ORDER BY bezeichnung
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_LC_get_stammdaten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: Stefan Hutter
|
|
-- Create date: 14.4.2009
|
|
-- Description: Liest die Stammdatentabellen
|
|
-- Changelog:
|
|
-- 15.4.09 Anpassung, dass nur die aktiven Datenelemente ausgelesen werden
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_LC_get_stammdaten]
|
|
@mitarbeiternr int,
|
|
@tabelle varchar(255),
|
|
@orderby varchar(255)
|
|
as
|
|
begin
|
|
declare @xsql varchar(255)
|
|
if upper(@tabelle)='KOSTENART' begin
|
|
select kostenartnr, bezeichnung + ' - ' + beschreibung as Bezeichnung from kostenart where aktiv=1 order by bezeichnung
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='KONTAKTTYP_GREMIUM' begin
|
|
select kontakttypnr, bezeichnung, applikationsbereichnr from kontakttyp where applikationsbereichnr=3 and aktiv=1 order by bezeichnung
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='RELEASEART' begin
|
|
select Releaseartnr, bezeichnung as Bezeichnung from Releaseart where aktiv=1 order by bezeichnung
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='PERSON' begin
|
|
select personnr, Name +' '+Vorname as Bezeichnung from Person where Vertragspartnernr=1 and Aktiv=1 order by Name, Vorname
|
|
return
|
|
end
|
|
if upper(@tabelle)='PERSON1' begin
|
|
select personnr, Name +' '+Vorname as Bezeichnung from Person where Vertragspartnernr=1 and Aktiv=1 order by Name, Vorname
|
|
return
|
|
end
|
|
if upper(@tabelle)='PERSON2' begin
|
|
select personnr, Name +' '+Vorname as Bezeichnung from Person where Vertragspartnernr=1 and Aktiv=1 order by Name, Vorname
|
|
return
|
|
end
|
|
|
|
if upper(@tabelle)='INSTALLATIONTYP' begin
|
|
SELECT * from installationtyp ORDER BY sort
|
|
return
|
|
end
|
|
|
|
|
|
set @xsql='Select * from ' + @tabelle + ' where aktiv=1 order by ' + @orderby
|
|
exec(@xsql)
|
|
end
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lc_get_Struktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lc_get_Struktur]
|
|
AS
|
|
BEGIN
|
|
declare @tmp1 TABLE (id int, parentid int, bezeichnung varchar(255),imageindex INT,beschreibung VARCHAR(1024), copy INT, sort int)
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
INSERT @tmp1 SELECT lc_produktnr AS id, lc_produktnr_parent AS parentid, bezeichnung, imageindex AS imageindex, ISNULL(Beschreibung,'') AS Beschreibung,0, ISNULL(sort,0) as sort FROM dbo.LC_Produkt WHERE aktiv=1 AND IstStruktur=1
|
|
|
|
INSERT @tmp1 ( id, parentid, bezeichnung, imageindex,beschreibung,copy,sort)
|
|
VALUES ( 0, NULL, 'Root', 1,'',0,-1)
|
|
|
|
|
|
UPDATE @tmp1 SET imageindex = imageindex + 0 WHERE id IN (SELECT lc_produktnr FROM lc_produkt WHERE IstStruktur=1)
|
|
SELECT *
|
|
FROM @tmp1
|
|
ORDER BY sort, bezeichnung
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lc_get_Struktur_Auswahl] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lc_get_Struktur_Auswahl]
|
|
@selectiontype AS integer
|
|
AS
|
|
BEGIN
|
|
DECLARE @tmp1 TABLE
|
|
(
|
|
id INT ,
|
|
parentid INT ,
|
|
bezeichnung VARCHAR(255) ,
|
|
imageindex INT ,
|
|
beschreibung VARCHAR(1024) ,
|
|
IstStruktur BIT ,
|
|
verweisnr INT ,
|
|
copy INT ,
|
|
originalid INT,
|
|
eingesetzt INT,
|
|
sort int
|
|
)
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
|
|
-- Alle Produkte
|
|
|
|
INSERT @tmp1
|
|
SELECT lc_produktnr AS id ,
|
|
lc_produktnr_parent AS parentid ,
|
|
bezeichnung ,
|
|
imageindex AS imageindex ,
|
|
ISNULL(Beschreibung, '') AS Beschreibung ,
|
|
IstStruktur ,
|
|
ISNULL(verweisnr, 0) AS Verweisnr ,
|
|
0 AS copy ,
|
|
LC_ProduktNr,
|
|
ISNULL(StatusNr,0),
|
|
ISNULL(sort,0) AS sort
|
|
FROM dbo.LC_Produkt
|
|
WHERE aktiv = 1
|
|
|
|
INSERT @tmp1
|
|
( id ,
|
|
parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
beschreibung ,
|
|
IstStruktur ,
|
|
verweisnr ,
|
|
copy,
|
|
eingesetzt,sort
|
|
)
|
|
VALUES ( 0 ,
|
|
NULL ,
|
|
'Root' ,
|
|
1 ,
|
|
'' ,
|
|
1 ,
|
|
0 ,
|
|
0,
|
|
0,
|
|
-1
|
|
)
|
|
|
|
UPDATE @tmp1
|
|
SET imageindex = imageindex + 0
|
|
WHERE id IN ( SELECT lc_produktnr
|
|
FROM lc_produkt
|
|
WHERE IstStruktur = 1 )
|
|
|
|
INSERT @tmp1
|
|
( id ,
|
|
parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
beschreibung ,
|
|
IstStruktur ,
|
|
verweisnr ,
|
|
copy ,
|
|
Originalid,
|
|
eingesetzt,
|
|
sort
|
|
)
|
|
SELECT dbo.LC_Produkt_Copy.lc_produkt_copynr AS id ,
|
|
dbo.LC_Produkt_Copy.lc_produkt_parentnr AS parentid ,
|
|
dbo.LC_Produkt.Bezeichnung ,
|
|
dbo.LC_Produkt.Imageindex ,
|
|
dbo.LC_Produkt.Beschreibung ,
|
|
0 ,
|
|
0 ,
|
|
1 ,
|
|
lc_produkt.LC_ProduktNr,
|
|
ISNULL(lc_produkt.StatusNr,0), 0
|
|
FROM dbo.LC_Produkt_Copy
|
|
INNER JOIN dbo.LC_Produkt ON dbo.LC_Produkt_Copy.lc_produktnr = dbo.LC_Produkt.LC_ProduktNr
|
|
WHERE ( dbo.LC_Produkt_Copy.aktiv = 1 )
|
|
AND ( dbo.LC_Produkt.Aktiv = 1 )
|
|
|
|
IF @selectiontype=1 BEGIN
|
|
DELETE FROM @tmp1 WHERE IstStruktur=0 AND eingesetzt=0
|
|
INSERT @tmp1
|
|
( id ,
|
|
parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
beschreibung ,
|
|
IstStruktur ,
|
|
verweisnr ,
|
|
copy ,
|
|
Originalid,
|
|
eingesetzt,sort
|
|
)
|
|
SELECT lc_produktnr AS id ,
|
|
lc_produktnr_parent AS parentid ,
|
|
bezeichnung ,
|
|
imageindex AS imageindex ,
|
|
ISNULL(Beschreibung, '') AS Beschreibung ,
|
|
IstStruktur ,
|
|
ISNULL(verweisnr, 0) AS Verweisnr ,
|
|
0 AS copy ,
|
|
LC_ProduktNr,
|
|
ISNULL(StatusNr,0),
|
|
ISNULL(sort,0)
|
|
FROM dbo.LC_Produkt
|
|
WHERE aktiv = 1 AND lc_produktnr NOT IN (SELECT id FROM @tmp1) AND lc_produktnr IN (SELECT parentid FROM @tmp1)
|
|
|
|
END
|
|
IF @selectiontype=2 BEGIN
|
|
DELETE FROM @tmp1 WHERE IstStruktur=0 AND eingesetzt=1
|
|
INSERT @tmp1
|
|
( id ,
|
|
parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
beschreibung ,
|
|
IstStruktur ,
|
|
verweisnr ,
|
|
copy ,
|
|
Originalid,
|
|
eingesetzt,
|
|
sort
|
|
)
|
|
SELECT lc_produktnr AS id ,
|
|
lc_produktnr_parent AS parentid ,
|
|
bezeichnung ,
|
|
imageindex AS imageindex ,
|
|
ISNULL(Beschreibung, '') AS Beschreibung ,
|
|
IstStruktur ,
|
|
ISNULL(verweisnr, 0) AS Verweisnr ,
|
|
0 AS copy ,
|
|
LC_ProduktNr,
|
|
ISNULL(StatusNr,0),
|
|
ISNULL(sort,0) AS sort
|
|
FROM dbo.LC_Produkt
|
|
WHERE aktiv = 1 AND lc_produktnr NOT IN (SELECT id FROM @tmp1) AND lc_produktnr IN (SELECT parentid FROM @tmp1)
|
|
end
|
|
|
|
SELECT *
|
|
FROM @tmp1
|
|
ORDER BY sort,bezeichnung
|
|
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lc_get_Struktur_Einsatzgebiet] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lc_get_Struktur_Einsatzgebiet]
|
|
AS
|
|
BEGIN
|
|
declare @tmp1 TABLE (id int, parentid int, bezeichnung varchar(255),imageindex int)
|
|
SET NOCOUNT ON;
|
|
|
|
-- Insert statements for procedure here
|
|
INSERT @tmp1
|
|
SELECT [LC_EinsatzgebietNr] AS ID
|
|
,[LC_EinsatzgebietNr_Parent] AS PARENTID
|
|
,[Bezeichnung] AS BEZEICHNUNG
|
|
,imagenr AS imageindex
|
|
|
|
FROM [dbo].[LC_Einsatzgebiet]
|
|
WHERE Aktiv = 1
|
|
|
|
INSERT @tmp1 ( id, parentid, bezeichnung, imageindex)
|
|
VALUES ( 0, NULL, 'Root', 1)
|
|
|
|
|
|
SELECT *
|
|
FROM @tmp1
|
|
ORDER BY bezeichnung
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lc_reporting] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lc_reporting]
|
|
@fnkt INT,
|
|
@param1 VARCHAR(4096),
|
|
@param2 VARCHAR(4096),
|
|
@param3 VARCHAR(4096),
|
|
@param4 VARCHAR(4096),
|
|
@param5 VARCHAR(4096),
|
|
@param6 VARCHAR(4096)
|
|
AS
|
|
BEGIN
|
|
-- Abgelaufene Überprüfungen
|
|
IF @fnkt=1 BEGIN
|
|
SELECT lc_produktnr AS ProduktNr, bezeichnung AS Produkt, Nächste_Ueberprüfung AS N_Ueberpruefung FROM lc_produkt WHERE Nächste_Ueberprüfung < GETDATE() AND aktiv=1 AND Nächste_Ueberprüfung<>'01.01.1900'
|
|
END
|
|
-- Abgelaufenen Produkte in N Tagen
|
|
IF @fnkt=2 BEGIN
|
|
SELECT lc_produktnr AS ProduktNr, bezeichnung AS Produkt, Nächste_Ueberprüfung AS N_Ueberpruefung, DATEDIFF(DAY, GETDATE(),Nächste_Ueberprüfung) AS in_Tagen
|
|
FROM lc_produkt
|
|
WHERE DATEDIFF(DAY,GETDATE(),Nächste_Ueberprüfung) <= @param1 AND aktiv=1 AND Nächste_Ueberprüfung<>'01.01.1900'
|
|
END
|
|
-- Abgelaufene Entscheidungen
|
|
IF @fnkt=3 BEGIN
|
|
SELECT lc_produktnr AS ProduktNr, bezeichnung AS Produkt, Entscheidungstermin AS Termin
|
|
FROM lc_produkt WHERE Entscheidungstermin < GETDATE() AND aktiv=1 AND Entscheidungstermin<>'01.01.1900'
|
|
END
|
|
--
|
|
IF @fnkt=4 BEGIN
|
|
SELECT lc_produktnr AS ProduktNr, bezeichnung AS Produkt, Entscheidungstermin AS Termin, DATEDIFF(DAY, GETDATE(),Entscheidungstermin) AS in_Tagen
|
|
FROM lc_produkt
|
|
WHERE DATEDIFF(DAY,GETDATE(),Entscheidungstermin) <= @param1 AND aktiv=1 AND Entscheidungstermin<>'01.01.1900'
|
|
END
|
|
|
|
DECLARE @cols AS NVARCHAR(MAX),
|
|
@query AS NVARCHAR(MAX)
|
|
|
|
print @param1
|
|
print @param2
|
|
print @param3
|
|
print @param4
|
|
-- Roadmap nach Phasen
|
|
IF @fnkt=5 OR @fnkt=7 BEGIN
|
|
if @fnkt=5 begin
|
|
IF @param2='' SET @param2='01.01.1900'
|
|
IF @param3='' SET @param3='31.12.4712'
|
|
|
|
end
|
|
IF @fnkt=7 BEGIN
|
|
--SET @param3='31.12.4712'
|
|
set @param3=left(convert(varchar,dateadd(day,cast(@param2 as int),getdate()),104),10)
|
|
set @param2 =left(convert(varchar,getdate(),104),10)
|
|
END
|
|
|
|
|
|
print @param2
|
|
print @param3
|
|
|
|
select @cols = STUFF((SELECT distinct ',' + QUOTENAME(Phase) from dbo.lc_rpt3(@param1,@param2,@param3,@param4)
|
|
FOR XML PATH(''), TYPE
|
|
).value('.', 'NVARCHAR(MAX)')
|
|
,1,1,'')
|
|
set @query = 'SELECT lc_produktnr as ProduktNr, Produkt,' + @cols + ' from
|
|
(
|
|
select p.lc_produktnr,p.Produkt,
|
|
p.datum,
|
|
d.phase
|
|
from dbo.lc_rpt4('+CHAR(39)+@param1+CHAR(39)+','+CHAR(39)+@param2+CHAR(39)+','+CHAR(39)+@param3+CHAR(39)+','+@param4+') p
|
|
left join dbo.lc_rpt3('+CHAR(39)+@param1+CHAR(39)+','+CHAR(39)+@param2+CHAR(39)+','+CHAR(39)+@param3+CHAR(39)+','+@param4+') d
|
|
on p.lc_phasenr = d.lc_phasenr
|
|
) x
|
|
pivot
|
|
(
|
|
max(datum)
|
|
for Phase in (' + @cols + ')
|
|
) p '
|
|
|
|
|
|
execute(@query)
|
|
end
|
|
|
|
|
|
-- Roadmap nach Produkten
|
|
IF @fnkt=6 BEGIN
|
|
IF @param2='' SET @param2='01.01.1900'
|
|
IF @param3='' SET @param3='31.12.4712'
|
|
--set @param2=right(@param2,4)+'-'+substring(@param2,4,2)+'-'+left(@param2,2)
|
|
--set @param3=right(@param3,4)+'-'+substring(@param3,4,2)+'-'+left(@param3,2)
|
|
select @cols = STUFF((SELECT distinct ',' + QUOTENAME(Phase) from dbo.lc_rpt1(@param1,@param2,@param3, @param4)
|
|
FOR XML PATH(''), TYPE
|
|
).value('.', 'NVARCHAR(MAX)')
|
|
,1,1,'')
|
|
PRINT @cols
|
|
|
|
set @query = 'SELECT lc_produktnr as ProduktNr, Produkt,' + @cols + ' from
|
|
(
|
|
select p.lc_produktnr,p.Produkt,
|
|
p.datum,
|
|
d.phase
|
|
from dbo.lc_rpt2('+CHAR(39)+@param1+CHAR(39)+','+CHAR(39)+@param2+CHAR(39)+','+CHAR(39)+@param3+CHAR(39)+','+@param4+') p
|
|
left join dbo.lc_rpt1('+CHAR(39)+@param1+CHAR(39)+','+CHAR(39)+@param2+CHAR(39)+','+CHAR(39)+@param3+CHAR(39)+','+@param4+') d
|
|
on p.lc_phasenr = d.lc_phasenr
|
|
) x
|
|
pivot
|
|
(
|
|
max(datum)
|
|
for Phase in (' + @cols + ')
|
|
) p '
|
|
|
|
execute(@query)
|
|
end
|
|
|
|
|
|
|
|
-- IF @fnkt=7 BEGIN
|
|
-- select @cols = STUFF((SELECT distinct ',' + QUOTENAME(Phase) from dbo.lc_rpt5(@param1,@param2)
|
|
-- FOR XML PATH(''), TYPE
|
|
-- ).value('.', 'NVARCHAR(MAX)')
|
|
-- ,1,1,'')
|
|
--PRINT @cols
|
|
|
|
--set @query = 'SELECT lc_produktnr as ProduktNr, Produkt,' + @cols + ' from
|
|
-- (
|
|
-- select p.lc_produktnr,p.Produkt,
|
|
-- p.datum,
|
|
-- d.phase
|
|
-- from dbo.lc_rpt6('+CHAR(39)+@param1+CHAR(39)+','+CHAR(39)+@param2+CHAR(39)+') p
|
|
-- left join dbo.lc_rpt5('+CHAR(39)+@param1+CHAR(39)+','+CHAR(39)+@param2+CHAR(39)+') d
|
|
-- on p.lc_phasenr = d.lc_phasenr
|
|
-- ) x
|
|
-- pivot
|
|
-- (
|
|
-- max(datum)
|
|
-- for Phase in (' + @cols + ')
|
|
-- ) p '
|
|
|
|
-- execute(@query)
|
|
-- end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--IF OBJECT_ID (N'_tmp_lc_rpt1', N'U') IS NOT NULL DROP TABLE [dbo].[_tmp_lc_rpt1]
|
|
--IF OBJECT_ID (N'_tmp_lc_rpt2', N'U') IS NOT NULL DROP TABLE [dbo].[_tmp_lc_rpt2]
|
|
--SELECT * INTO _tmp_lc_rpt1 FROM dbo.lc_rpt1(@param1,@param2,@param3)
|
|
--SELECT * INTO _tmp_lc_rpt2 FROM dbo.lc_rpt2(@param1,@param2,@param3)
|
|
|
|
|
|
--set @query = 'SELECT lc_produktnr as ProduktNr, Produkt,' + @cols + ' from
|
|
-- (
|
|
-- select p.lc_produktnr,p.Produkt,
|
|
-- p.datum,
|
|
-- d.phase
|
|
-- from _tmp_lc_rpt2 p
|
|
-- left join _tmp_lc_rpt1 d
|
|
-- on p.lc_phasenr = d.lc_phasenr
|
|
-- ) x
|
|
-- pivot
|
|
-- (
|
|
-- max(datum)
|
|
-- for Phase in (' + @cols + ')
|
|
-- ) p '
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lizenz_inaktivieren] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lizenz_inaktivieren]
|
|
@lizenznr int,
|
|
@mutierer int
|
|
AS
|
|
BEGIN
|
|
|
|
update lizenzkauf set aktiv=0, mutiert_am=getdate(),mutierer=@mutierer where lizenznr=@lizenznr and Aktiv=1
|
|
update LizenzVertragselementApplikation set aktiv=0, mutiert_am=getdate(),mutierer=@mutierer where lizenznr=@lizenznr and Aktiv=1
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lizenzkauf_inaktivieren] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
create PROCEDURE [dbo].[sp_lizenzkauf_inaktivieren]
|
|
@vertragselementapplikationnr int,
|
|
@mutierer int
|
|
|
|
AS
|
|
BEGIN
|
|
update Lizenzkauf set Aktiv=0, Mutierer=@mutierer, Mutiert_am=GETDATE() where Aktiv=1 and vertragselementapplikationnr=@vertragselementapplikationnr
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_lizenzschluessel_inaktivieren] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_lizenzschluessel_inaktivieren]
|
|
@lizenzkaufnr int,
|
|
@mutierer int
|
|
|
|
AS
|
|
BEGIN
|
|
update Lizenzschluessel set Aktiv=0, Mutierer=@mutierer, Mutiert_am=GETDATE() where Aktiv=1 and Lizenzkaufnr=@lizenzkaufnr
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_mitarbeiter_auswertungparamter_selectall] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_mitarbeiter_auswertungparamter_selectall]
|
|
@mitarbeiternr int,
|
|
@Auswertungnr int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
select * from Mitarbeiter_Auswertungsparameter where mitarbeiternr=@mitarbeiternr and auswertungnr=@auswertungnr order by Beschreibung
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_mittelfristplanung] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_mittelfristplanung]
|
|
@datumvon datetime,
|
|
@datumbis datetime,
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
declare @tmptabl1 varchar(255)
|
|
declare @xsql varchar(4096)
|
|
declare @cnt int
|
|
declare @year int
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@mitarbeiternr)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
set @tmptabl1='dbo.'+@tmptabl1
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle mit Anzahl Spalten nach Jahren anlegen
|
|
-- =============================================
|
|
set @xsql='Create table ' + @tmptabl1 + '([Ereignisnr] [int] NULL'
|
|
set @cnt=YEAR(@datumbis) - YEAR(@datumvon)
|
|
set @year = YEAR(@datumvon)
|
|
while @year < YEAR(@datumbis)+1 begin
|
|
set @xsql = @xsql + ' ,[Kosten_'+LTRIM(str(@year))+'] [decimal] (18,2) NULL'
|
|
set @xsql = @xsql + ' ,[Mwst_'+LTRIM(str(@year))+'] [decimal] (18,2) NULL'
|
|
set @xsql = @xsql + ' ,[Total_'+LTRIM(str(@year))+'] [decimal] (18,2) NULL'
|
|
set @year=@year+1
|
|
end
|
|
set @xsql=@xsql+') on [default]'
|
|
execute(@xsql)
|
|
|
|
|
|
-- =============================================
|
|
-- Ereignisse verarbeiten - Initialverarbeitung
|
|
-- =============================================
|
|
declare @enr int
|
|
declare xc cursor for
|
|
select ereignisnr from dbo.Vertragsereignis where ereignistypnr=3
|
|
and periodizitaetnr <> 0
|
|
|
|
--and ereignisnr not in (select ereignisnr from Vertragsereignis where Datum<>'1900-01-01' and Start<>'1900-01-01' and Ende <> '1900-01-01')
|
|
open xc
|
|
fetch next from xc into @enr
|
|
while @@FETCH_STATUS=0 begin
|
|
execute dbo.sp_mittelfristplanung_berechnung @datumvon, @datumbis, @mitarbeiternr, @enr
|
|
fetch next from xc into @enr
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
-- =============================================
|
|
-- Nullvalues mit 0 ersetzen
|
|
-- =============================================
|
|
set @year = YEAR(@datumvon)
|
|
while @year < YEAR(@datumbis)+1 begin
|
|
set @xsql = 'update ' + @tmptabl1 + ' set ' + '[Kosten_'+LTRIM(str(@year))+']' + ' = 0 where ' + '[Kosten_'+LTRIM(str(@year))+']' + ' is null'
|
|
execute (@xsql)
|
|
set @xsql = 'update ' + @tmptabl1 + ' set ' + '[Mwst_'+LTRIM(str(@year))+']' + ' = 0 where ' + '[Mwst_'+LTRIM(str(@year))+']' + ' is null'
|
|
execute (@xsql)
|
|
set @xsql = 'update ' + @tmptabl1 + ' set ' + '[Total_'+LTRIM(str(@year))+']' + ' = 0 where ' + '[Total_'+LTRIM(str(@year))+']' + ' is null'
|
|
execute (@xsql)
|
|
set @year=@year+1
|
|
end
|
|
|
|
|
|
-- =============================================
|
|
-- Resultat ausgeben
|
|
-- =============================================
|
|
set @xsql='SELECT dbo.Kostenart.Bezeichnung AS Kostenart, dbo.Vertragspartner.NameZ1 AS Vertragspartner, Vertragselement_1.Bezeichnung AS Uebergeordnetes_VE, '
|
|
set @xsql=@xsql+' dbo.Vertragselement.Nummer AS Vertragsnummer, dbo.Vertragselement.Bezeichnung AS Bezeichnung_VE, dbo.Vertragsereignis.Bezeichnung AS Bezeichnung_EG, '
|
|
set @xsql=@xsql+' dbo.Periodizitaet.Bezeichnung AS Periodizitaet, dbo.Vertragsereignis.InklMwSt AS InklMwst, ' + @tmptabl1 +'.*'
|
|
set @xsql=@xsql+' FROM dbo.Vertragsereignis INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Vertragselement ON dbo.Vertragsereignis.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kostenart ON dbo.Vertragsereignis.KostenartNr = dbo.Kostenart.KostenartNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Periodizitaet ON dbo.Vertragsereignis.PeriodizitaetNr = dbo.Periodizitaet.PeriodizitaetNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN'
|
|
set @xsql=@xsql+' ' + @tmptabl1 + ' ON dbo.Vertragsereignis.EreignisNr = ' + @tmptabl1+'.Ereignisnr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.Vertragselement AS Vertragselement_1 ON dbo.Vertragselement.ParentID = Vertragselement_1.Vertragselementnr'
|
|
print @xsql
|
|
execute (@xsql)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@mitarbeiternr)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_mittelfristplanung_addvalue] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_mittelfristplanung_addvalue]
|
|
@year int,
|
|
@betrag float,
|
|
@inklmwst int,
|
|
@ereignisnr int,
|
|
@tmptabl varchar(255)
|
|
AS
|
|
BEGIN
|
|
declare @cnt int
|
|
declare @xsql nvarchar (1024)
|
|
declare @tmpbetrag float
|
|
declare @tmpmwstbetrag float
|
|
declare @tmptotal float
|
|
declare @mwst float
|
|
declare @mwstBetrag float
|
|
declare @mwstsatz float
|
|
declare @total float
|
|
select @mwstsatz=mwstsatz from dbo.mwstsatz where jahr=@year
|
|
if @inklmwst=1 begin
|
|
set @mwstBetrag=(@betrag / (100 + @mwstsatz)) * @mwstsatz
|
|
set @betrag = @betrag - @mwstbetrag
|
|
end else begin
|
|
set @mwstBetrag = (@betrag * @mwstsatz) / 100
|
|
end
|
|
set @total=@betrag + @mwstBetrag
|
|
|
|
set @xsql='select @RECORDCNT=count(*) from ' + @tmptabl + ' where Ereignisnr = ' + STR(@ereignisnr)
|
|
execute sp_executesql @xsql,N'@RECORDCNT int out',@cnt out
|
|
if @cnt=0 begin
|
|
|
|
set @xsql='Insert ' + @tmptabl + ' (Ereignisnr,[Kosten_'+ltrim(str(@year))+'], [Mwst_'+ltrim(str(@year))+'], [Total_'+ltrim(str(@year))+']) values('+ltrim(str(@ereignisnr))+','+convert(varchar,@betrag)+','+CONVERT(varchar,@mwstbetrag)+','+CONVERT(varchar,@Total)+')'
|
|
execute (@xsql)
|
|
end else begin
|
|
set @xsql = 'select @zbetrag=isnull([Kosten_'+LTRIM(str(@year))+'],0), @zmwst=isnull([mwst_'+LTRIM(str(@year))+'],0), @ztotal=isnull([total_'+LTRIM(str(@year))+'],0) from ' + @tmptabl + ' where Ereignisnr = ' + STR(@ereignisnr)
|
|
execute sp_executesql @xsql,N'@zbetrag float out, @zmwst float out, @ztotal float out',@tmpbetrag out, @tmpmwstbetrag out, @tmptotal out
|
|
set @tmpbetrag=@tmpbetrag+@betrag
|
|
set @tmpmwstbetrag = @tmpmwstbetrag + @mwstBetrag
|
|
set @tmptotal = @tmptotal + @total
|
|
set @xsql = 'update ' + @tmptabl + ' set [Kosten_'+ltrim(str(@year))+'] = ' + CONVERT(varchar, @tmpbetrag) + ', [Mwst_'++ltrim(str(@year))+'] = ' + CONVERT(varchar, @tmpmwstbetrag) + ', [Total_'++ltrim(str(@year))+'] = ' + CONVERT(varchar, @tmptotal)+' where Ereignisnr = ' + STR(@ereignisnr)
|
|
execute (@xsql)
|
|
|
|
end
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_mittelfristplanung_berechnung] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
CREATE PROCEDURE [dbo].[sp_mittelfristplanung_berechnung]
|
|
@datumvon datetime,
|
|
@datumbis datetime,
|
|
@mitarbeiternr int,
|
|
@ereignisnr int
|
|
AS
|
|
print 'Ereignis ---> ' + str(@ereignisnr)
|
|
-- Deklarationen
|
|
declare @tmptabl1 varchar(255)
|
|
declare @workdate datetime
|
|
declare @enddate datetime
|
|
declare @year int
|
|
declare @dd datetime
|
|
set @dd='1900-01-01'
|
|
|
|
-- VE-Elemente
|
|
declare @datum datetime
|
|
declare @veendedatum datetime
|
|
declare @start datetime
|
|
declare @ende datetime
|
|
declare @mutdat datetime
|
|
declare @aktiv int
|
|
declare @periode int
|
|
declare @betrag float
|
|
declare @inklmwst int
|
|
declare @vertragselementnr int
|
|
declare @gekuendigtper datetime
|
|
--****************************************************************************************************************************
|
|
-- Temporäre Tabelle
|
|
--****************************************************************************************************************************
|
|
set @tmptabl1 = str(@mitarbeiternr)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'dbo.tmp_mfp_' + @tmptabl1
|
|
|
|
--****************************************************************************************************************************
|
|
-- Vertragselement auslesen
|
|
--****************************************************************************************************************************
|
|
select @datum=datum, @start=start, @ende=ende, @mutdat=mutiert_am, @aktiv=aktiv, @periode=periodizitaetnr, @betrag=betrag,@inklmwst=InklMwSt, @vertragselementnr=Vertragselementnr
|
|
from dbo.vertragsereignis
|
|
where dbo.vertragsereignis.ereignisnr=@ereignisnr
|
|
|
|
select @veendedatum = dbo.vertragselement.vertragsablauf, @gekuendigtper=dbo.Vertragselement.Gekuendigt_per
|
|
from dbo. Vertragselement
|
|
where Vertragselementnr=@vertragselementnr
|
|
|
|
--****************************************************************************************************************************
|
|
-- Einmalige Ereignisse
|
|
--****************************************************************************************************************************
|
|
if @periode=15 or @periode = 0 begin
|
|
-- Vertragselement mit Gekündigt_per-Datum
|
|
if @gekuendigtper <=@dd begin
|
|
-- Aktiv und VE-Datum in der Selektionsperiode -> verwenden
|
|
if @aktiv=1 and @datum >= @datumvon and @datum <= @datumbis begin
|
|
set @year = YEAR(@datum)
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst, @ereignisnr, @tmptabl1
|
|
end
|
|
-- Inaktiv nach nach der Selektionsperiode, -> verwenden
|
|
if @aktiv=0 and @mutdat > @datumbis begin
|
|
set @year = YEAR(@datum)
|
|
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst,@ereignisnr, @tmptabl1
|
|
end
|
|
end else begin
|
|
-- Aktiv und VE-Datum in der Selektionsperiode -> verwenden
|
|
if @aktiv=1 and @datum <= @gekuendigtper and @datum >= @datumvon and @datum <=@datumbis begin
|
|
set @year = YEAR(@datum)
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst, @ereignisnr, @tmptabl1
|
|
|
|
end
|
|
-- Inaktiv nach nach der Selektionsperiode, -> verwenden
|
|
if @aktiv=0 and @mutdat > @gekuendigtper and @mutdat >=@datumvon and @mutdat <= @datumbis begin
|
|
set @year = YEAR(@datum)
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst,@ereignisnr, @tmptabl1
|
|
end
|
|
end
|
|
return
|
|
end
|
|
|
|
--****************************************************************************************************************************
|
|
-- Aktive Ereignisse
|
|
--****************************************************************************************************************************
|
|
|
|
|
|
if @periode <> 15 and @aktiv=1 begin
|
|
set @workdate=@start
|
|
if @ende = @dd set @ende = @datumbis
|
|
if @veendedatum > @dd and @veendedatum<@ende set @ende=@veendedatum
|
|
|
|
if @gekuendigtper <= @dd begin
|
|
while @workdate <= @ende begin
|
|
if @workdate >= @datumvon and @workdate <= @datumbis begin
|
|
set @year=YEAR(@workdate)
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst, @ereignisnr, @tmptabl1
|
|
end
|
|
if @periode = 10 set @workdate=dateadd(dd,1,@workdate)
|
|
if @periode = 11 set @workdate=dateadd(ww,1,@workdate)
|
|
if @periode = 12 set @workdate=dateadd(mm,1,@workdate)
|
|
if @periode =13 set @workdate=dateadd(mm,2,@workdate)
|
|
if @periode = 16 set @workdate=dateadd(qq,1,@workdate)
|
|
if @periode = 14 set @workdate=dateadd(qq,2,@workdate)
|
|
if @periode =9 set @workdate=dateadd(yy,1,@workdate)
|
|
end
|
|
end else begin
|
|
while @workdate <= @gekuendigtper begin
|
|
if @workdate >= @datumvon and @workdate <= @datumbis begin
|
|
set @year=YEAR(@workdate)
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst, @ereignisnr, @tmptabl1
|
|
end
|
|
if @periode = 10 set @workdate=dateadd(dd,1,@workdate)
|
|
if @periode = 11 set @workdate=dateadd(ww,1,@workdate)
|
|
if @periode = 12 set @workdate=dateadd(mm,1,@workdate)
|
|
if @periode =13 set @workdate=dateadd(mm,2,@workdate)
|
|
if @periode = 16 set @workdate=dateadd(qq,1,@workdate)
|
|
if @periode = 14 set @workdate=dateadd(qq,2,@workdate)
|
|
if @periode =9 set @workdate=dateadd(yy,1,@workdate)
|
|
end
|
|
end
|
|
end
|
|
--****************************************************************************************************************************
|
|
-- Inaktive Ereignisse
|
|
--****************************************************************************************************************************
|
|
|
|
if @periode <> 15 and @aktiv=0 begin
|
|
set @workdate=@start
|
|
if @ende <=@dd set @ende = @datumbis
|
|
if @workdate <= @dd begin
|
|
while @workdate <= @mutdat begin
|
|
if @workdate >= @datumvon and @workdate <= @datumbis begin
|
|
set @year=YEAR(@workdate)
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst, @ereignisnr, @tmptabl1
|
|
end
|
|
if @periode = 10 set @workdate=dateadd(dd,1,@workdate)
|
|
if @periode = 11 set @workdate=dateadd(ww,1,@workdate)
|
|
if @periode = 12 set @workdate=dateadd(mm,1,@workdate)
|
|
if @periode =13 set @workdate=dateadd(mm,2,@workdate)
|
|
if @periode = 16 set @workdate=dateadd(qq,1,@workdate)
|
|
if @periode = 14 set @workdate=dateadd(qq,2,@workdate)
|
|
if @periode =9 set @workdate=dateadd(yy,1,@workdate)
|
|
end
|
|
end else begin
|
|
while @workdate <= @gekuendigtper begin
|
|
if @workdate >= @datumvon and @workdate <= @datumbis begin
|
|
set @year=YEAR(@workdate)
|
|
execute dbo.sp_mittelfristplanung_addvalue @year,@betrag, @inklmwst, @ereignisnr, @tmptabl1
|
|
end
|
|
if @periode = 10 set @workdate=dateadd(dd,1,@workdate)
|
|
if @periode = 11 set @workdate=dateadd(ww,1,@workdate)
|
|
if @periode = 12 set @workdate=dateadd(mm,1,@workdate)
|
|
if @periode =13 set @workdate=dateadd(mm,2,@workdate)
|
|
if @periode = 16 set @workdate=dateadd(qq,1,@workdate)
|
|
if @periode = 14 set @workdate=dateadd(qq,2,@workdate)
|
|
if @periode =9 set @workdate=dateadd(yy,1,@workdate)
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_mittelfristplanung_differenzen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_mittelfristplanung_differenzen]
|
|
@datumvon datetime,
|
|
@datumbis datetime
|
|
as
|
|
BEGIN
|
|
|
|
DECLARE @Mutationen TABLE
|
|
(
|
|
Typ varchar(10),
|
|
Vertragsereignis varchar(255),
|
|
Vertragselement varchar(255),
|
|
Vertragspartner varchar(255),
|
|
Element varchar(255),
|
|
Alter_Wert varchar(255),
|
|
Neuer_Wert varchar(255),
|
|
Datum varchar(255)
|
|
)
|
|
|
|
|
|
declare @ve varchar(255)
|
|
declare @velement varchar(255)
|
|
declare @vp varchar(255)
|
|
declare @vnr int
|
|
declare @vpnr int
|
|
declare @datum datetime
|
|
|
|
-- Neue Vertragsereignisse
|
|
declare xc cursor for
|
|
select bezeichnung, vertragselementnr, erstellt_am from dbo.Vertragsereignis where EreignistypNr=3
|
|
and Erstellt_am >= @datumvon and Erstellt_am <= @datumbis
|
|
|
|
open xc
|
|
fetch next from xc into @ve, @vnr, @datum
|
|
while @@FETCH_STATUS=0 begin
|
|
select @velement=bezeichnung, @vpnr=vertragspartnernr from Vertragselement where vertragselementnr=@vnr
|
|
select @vp=namez1 from Vertragspartner where VertragspartnerNr=@vpnr
|
|
insert @Mutationen(Typ,Vertragsereignis, Vertragselement, Vertragspartner, Element, neuer_wert, alter_wert, datum) values ('E',@ve,@velement,@vp,'Neu erstellt','','',@datum)
|
|
fetch next from xc into @ve, @vnr, @datum
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
-- Neue Vertragselemente
|
|
insert @Mutationen(Typ,Vertragsereignis, Vertragselement, Vertragspartner, Element, neuer_wert, alter_wert, datum)
|
|
SELECT distinct 'V' AS Typ, '' AS Vertragsereignis, dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Vertragspartner.NameZ1 AS Vertragspartner,
|
|
'Neu erstellt' AS element, '' AS alter_wert, '' AS neuer_wert, dbo.Vertragselement.Erstellt_am
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragsereignis ON dbo.Vertragselement.Vertragselementnr = dbo.Vertragsereignis.Vertragselementnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
WHERE (dbo.Vertragsereignis.EreignistypNr = 3)
|
|
and dbo.vertragselement.Erstellt_am >= @datumvon and dbo.vertragselement.Erstellt_am <= @datumbis
|
|
|
|
-- Mutationen auf Vertragsereignis
|
|
insert @Mutationen
|
|
SELECT 'E' as Typ, dbo.Vertragsereignis.Bezeichnung AS Vertragsereignis, dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Vertragspartner.NameZ1 AS Partner,
|
|
dbo.History.HistoryObjectdetails, dbo.History.Alter_Wert,
|
|
--dbo.History.Neuer_Wert
|
|
case when dbo.History.Neuer_Wert='Inaktiv' then 'Inaktiv (V-Ereignis)' else dbo.History.Neuer_Wert end as Neuer_Wert,
|
|
convert(datetime,dbo.History.Erstellt_am)
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragsereignis ON dbo.Vertragselement.Vertragselementnr = dbo.Vertragsereignis.Vertragselementnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.History ON dbo.Vertragsereignis.EreignisNr = dbo.History.HistoryObjekctKey
|
|
where dbo.History.Erstellt_am >= @datumvon and dbo.History.Erstellt_am <= @datumbis and dbo.Vertragsereignis.EreignistypNr=3
|
|
and dbo.History.HistoryTypNr=2
|
|
|
|
-- Mutationen auf Vertragselement
|
|
insert @Mutationen
|
|
SELECT 'V' as Typ,'' AS Vertragsereignis, dbo.Vertragselement.Bezeichnung AS Vertragselement, dbo.Vertragspartner.NameZ1 AS Partner,
|
|
dbo.History.HistoryObjectDetails, dbo.History.Alter_Wert,
|
|
--dbo.history.Neuer_Wert
|
|
case when dbo.History.Neuer_Wert='Inaktiv' then 'Inaktiv (V-Element)' else dbo.History.Neuer_Wert end as Neuer_Wert,
|
|
|
|
CONVERT(datetime, dbo.History.Erstellt_am) AS Expr1
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragsereignis ON dbo.Vertragselement.Vertragselementnr = dbo.Vertragsereignis.Vertragselementnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.History ON dbo.Vertragselement.Vertragselementnr = dbo.History.HistoryObjekctKey
|
|
WHERE dbo.History.Erstellt_am >= @datumvon and dbo.History.Erstellt_am <= @datumbis and dbo.Vertragsereignis.EreignistypNr=3
|
|
and dbo.History.HistoryTypNr=1
|
|
|
|
select distinct * from @Mutationen order by Vertragsereignis, Datum
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_mittelfristplanung_differenzen_init] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_mittelfristplanung_differenzen_init]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
declare @dtvon varchar(100)
|
|
declare @dtbis varchar(100)
|
|
declare @ddtvon datetime
|
|
declare @ddtbis datetime
|
|
declare @manr int
|
|
set @dtvon = SUBSTRING(@sqlwhere,28,10) + ' 00:00:00'
|
|
set @dtbis = SUBSTRING(@sqlwhere, 142,10) + ' 23:59:59'
|
|
SELECT @manr=CAST(RAND() * 100 AS INT)
|
|
set @ddtvon=CONVERT(datetime,@dtvon,104)
|
|
set @ddtbis=CONVERT(datetime,@dtbis,104)
|
|
execute dbo.sp_mittelfristplanung_differenzen @ddtvon, @ddtbis
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_mittelfristplanung_init] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_mittelfristplanung_init]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
declare @dtvon varchar(100)
|
|
declare @dtbis varchar(100)
|
|
declare @ddtvon datetime
|
|
declare @ddtbis datetime
|
|
declare @manr int
|
|
set @dtvon = SUBSTRING(@sqlwhere,28,10) + ' 00:00:00'
|
|
set @dtbis = SUBSTRING(@sqlwhere, 142,10) + ' 23:59:59'
|
|
SELECT @manr=CAST(RAND() * 100 AS INT)
|
|
set @ddtvon=CONVERT(datetime,@dtvon,104)
|
|
set @ddtbis=CONVERT(datetime,@dtbis,104)
|
|
execute dbo.sp_mittelfristplanung @ddtvon, @ddtbis,@manr
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_AN_3] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_AN_3]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL ,
|
|
@iBereich VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @rtb_anteil INT
|
|
DECLARE @abwesenheit_anteil INT
|
|
|
|
SET @rtb_anteil = 30
|
|
SET @abwesenheit_anteil = 15
|
|
select @abwesenheit_anteil=dbo.get_arbeitstage_prozent(@oestruktur)
|
|
|
|
IF @ibereich IS NULL
|
|
SET @ibereich = ''
|
|
IF @von IS NULL
|
|
SET @von = '2015-01-01 00:00:00'
|
|
IF @bis IS NULL
|
|
SET @bis = '2015-03-31 23:59:50'
|
|
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 42
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
declare @dd1 varchar(2)
|
|
declare @mm1 varchar(2)
|
|
declare @yy1 varchar(4)
|
|
declare @datum varchar(255)
|
|
set @dd1=DAY(@von)
|
|
set @mm1=MONTH(@von)
|
|
set @yy1=YEAR(@von)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 00:00:00'
|
|
set @von=convert(datetime,@datum,20)
|
|
set @dd1=DAY(@bis)
|
|
set @mm1=MONTH(@bis)
|
|
set @yy1=YEAR(@bis)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 23:59:59'
|
|
set @bis=convert(datetime,@datum,20)
|
|
|
|
|
|
-- ****************************************************************************
|
|
-- Planaufwand der AN_Tickets auslesen
|
|
--****************************************************************************
|
|
DECLARE @planaufwand TABLE
|
|
(
|
|
tgnummer VARCHAR(255) ,
|
|
TicketID VARCHAR(55) ,
|
|
Kurzbeschreibung VARCHAR(1024) NULL ,
|
|
STATUS VARCHAR(255) ,
|
|
Bereich VARCHAR(255) ,
|
|
Aufwand INT ,
|
|
geleistet FLOAT ,
|
|
noch_zu_leisten FLOAT ,
|
|
noch_zu_leisten_1 FLOAT NULL ,
|
|
g_start DATETIME ,
|
|
g_erledigung DATETIME ,
|
|
SOLL_AZ FLOAT NULL ,
|
|
Fhr_Anteil FLOAT NULL ,
|
|
Abwesenheiten FLOAT NULL ,
|
|
RTB FLOAT NULL ,
|
|
pt_fhranteil FLOAT NULL ,
|
|
pt_abwesenheiten FLOAT NULL ,
|
|
pt_rtb FLOAT NULL ,
|
|
Pensum FLOAT NULL
|
|
)
|
|
|
|
DECLARE @ticketid VARCHAR(255) ,
|
|
@tgnummer VARCHAR(255) ,
|
|
@g_erledigung DATETIME ,
|
|
@g_start DATETIME ,
|
|
@status VARCHAR(255) ,
|
|
@bereich VARCHAR(255)
|
|
DECLARE @ma1 VARCHAR(255) ,
|
|
@p1 INT ,
|
|
@ma2 VARCHAR(255) ,
|
|
@p2 INT ,
|
|
@ma3 VARCHAR(255) ,
|
|
@p3 INT ,
|
|
@ma4 VARCHAR(255) ,
|
|
@p4 INT ,
|
|
@ma5 VARCHAR(255) ,
|
|
@p5 INT
|
|
DECLARE @ma6 VARCHAR(255) ,
|
|
@p6 INT ,
|
|
@ma7 VARCHAR(255) ,
|
|
@p7 INT ,
|
|
@ma8 VARCHAR(255) ,
|
|
@p8 INT ,
|
|
@ma9 VARCHAR(255) ,
|
|
@p9 INT
|
|
DECLARE @pos1 INT
|
|
DECLARE @pos2 INT
|
|
DECLARE @x VARCHAR(255)
|
|
DECLARE @y INT
|
|
DECLARE @yy VARCHAR(255)
|
|
DECLARE @mm VARCHAR(255)
|
|
DECLARE @tt VARCHAR(255)
|
|
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT DISTINCT
|
|
fullid ,
|
|
mitarbeiter_1 ,
|
|
planaufwand_1 ,
|
|
mitarbeiter_2 ,
|
|
planaufwand_2 ,
|
|
mitarbeiter_3 ,
|
|
planaufwand_3 ,
|
|
mitarbeiter_4 ,
|
|
planaufwand_4 ,
|
|
mitarbeiter_5 ,
|
|
planaufwand_5 ,
|
|
mitarbeiter_6 ,
|
|
planaufwand_6 ,
|
|
mitarbeiter_7 ,
|
|
planaufwand_7 ,
|
|
mitarbeiter_8 ,
|
|
planaufwand_8 ,
|
|
mitarbeiter_9 ,
|
|
planaufwand_9 ,
|
|
Geplantes_Erledigungsdatum ,
|
|
Geplantes_Startdatum AS Geplantes_Startdatum ,
|
|
Status ,
|
|
Bereich
|
|
FROM dbo.shu_view_an_excelexport_lst
|
|
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @ticketid, @ma1, @p1, @ma2, @p2, @ma3, @p3,
|
|
@ma4, @p4, @ma5, @p5, @ma6, @p6, @ma7, @p7, @ma8, @p8, @ma9, @p9,
|
|
@g_erledigung, @g_start, @status, @bereich
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
IF NOT @g_erledigung IS NULL
|
|
BEGIN
|
|
SET @yy = YEAR(@g_erledigung)
|
|
SET @mm = MONTH(@g_erledigung)
|
|
SET @tt = DAY(@g_erledigung)
|
|
SET @g_erledigung = @tt + '.' + @mm + '.' + @yy
|
|
+ ' 00:00:00'
|
|
SET @g_erledigung = DATEADD(DAY, 1, @g_erledigung)
|
|
END
|
|
IF NOT @g_start IS NULL
|
|
BEGIN
|
|
SET @yy = YEAR(@g_start)
|
|
SET @mm = MONTH(@g_start)
|
|
SET @tt = DAY(@g_start)
|
|
SET @g_start = @tt + '.' + @mm + '.' + @yy
|
|
+ ' 00:00:00'
|
|
SET @g_start = DATEADD(DAY, 1, @g_start)
|
|
END
|
|
|
|
|
|
IF LEN(@ma1) > 0
|
|
BEGIN
|
|
SET @x = @ma1
|
|
SET @y = @p1
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma2) > 0
|
|
BEGIN
|
|
SET @x = @ma2
|
|
SET @y = @p2
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma3) > 0
|
|
BEGIN
|
|
SET @x = @ma3
|
|
SET @y = @p3
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma4) > 0
|
|
BEGIN
|
|
SET @x = @ma4
|
|
SET @y = @p4
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma5) > 0
|
|
BEGIN
|
|
SET @x = @ma5
|
|
SET @y = @p5
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma6) > 0
|
|
BEGIN
|
|
SET @x = @ma6
|
|
SET @y = @p6
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma7) > 0
|
|
BEGIN
|
|
SET @x = @ma7
|
|
SET @y = @p7
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma8) > 0
|
|
BEGIN
|
|
SET @x = @ma8
|
|
SET @y = @p8
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma9) > 0
|
|
BEGIN
|
|
SET @x = @ma9
|
|
SET @y = @p9
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich
|
|
)
|
|
END
|
|
END
|
|
FETCH NEXT FROM xx INTO @ticketid, @ma1, @p1, @ma2, @p2, @ma3,
|
|
@p3, @ma4, @p4, @ma5, @p5, @ma6, @p6, @ma7, @p7, @ma8, @p8,
|
|
@ma9, @p9, @g_erledigung, @g_start, @status, @bereich
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
-- ****************************************************************************
|
|
-- Ende Planaufwand der AN_Tickets auslesen
|
|
-- ****************************************************************************
|
|
|
|
|
|
-- ****************************************************************************
|
|
-- Geleistete, noch zu leistende Tage
|
|
-- ****************************************************************************
|
|
|
|
UPDATE @planaufwand
|
|
SET geleistet = 0.00 ,
|
|
noch_zu_leisten = 00
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT [Ticket_ID] ,
|
|
[ForUserID] ,
|
|
[CalculatedValue]
|
|
FROM TXP_LVer_IN_AU
|
|
WHERE ticket_id LIKE 'AN%'
|
|
AND [Statusdatum] < @von
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @y
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
UPDATE @planaufwand
|
|
SET geleistet = geleistet + @y
|
|
WHERE tgnummer = @tgnummer
|
|
AND ticketid = @ticketid
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @y
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
UPDATE @planaufwand
|
|
SET geleistet = ROUND(geleistet / 8, 2)
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten = aufwand - geleistet
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1 = 0.00
|
|
DELETE FROM @planaufwand
|
|
WHERE g_start > @bis
|
|
DELETE FROM @planaufwand
|
|
WHERE g_erledigung < @von
|
|
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1 = noch_zu_leisten
|
|
|
|
DECLARE @gp_dauer FLOAT
|
|
DECLARE @rn_dauer FLOAT
|
|
DECLARE @faktor FLOAT
|
|
|
|
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT ticketid ,
|
|
tgnummer ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
noch_zu_leisten
|
|
FROM @planaufwand
|
|
WHERE g_erledigung > @bis
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @g_erledigung, @g_start,
|
|
@y
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SET @gp_dauer = DATEDIFF(DAY, @g_start, @g_erledigung)
|
|
IF @g_start <= @von
|
|
SET @gp_dauer = DATEDIFF(day, @von, @g_erledigung)
|
|
IF @g_start > @von
|
|
BEGIN
|
|
SET @rn_dauer = DATEDIFF(DAY, @g_start, @bis)
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @rn_dauer = DATEDIFF(DAY, @von, @bis)
|
|
END
|
|
SET @faktor = @rn_dauer / @gp_dauer
|
|
|
|
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1 = ROUND(noch_zu_leisten_1
|
|
* ( @rn_dauer / @gp_dauer ),
|
|
2)
|
|
WHERE ticketid = @ticketid
|
|
AND tgnummer = @tgnummer
|
|
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @g_erledigung,
|
|
@g_start, @y
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
--****************************************************************************
|
|
-- Ende Geleistete, noch zu leistende Tage
|
|
-- ****************************************************************************
|
|
|
|
|
|
DECLARE @an4 TABLE
|
|
(
|
|
[JJMM] [varchar](255) NULL ,
|
|
[OE] [varchar](50) NULL ,
|
|
[OESort] [int] NULL ,
|
|
[tgnummer] [varchar](50) NULL ,
|
|
[Name] [varchar](50) NULL ,
|
|
[Vorname] [varchar](50) NULL ,
|
|
[Sortierung] [int] NULL ,
|
|
[START] [datetime] NULL ,
|
|
[ende] [datetime] NULL ,
|
|
[Sort] [int] NULL ,
|
|
[Pensum] [varchar](255) NULL ,
|
|
[Soll] [float] NULL ,
|
|
[Geleistet] [float] NOT NULL ,
|
|
[Engagement_Effektiv] [float] NOT NULL ,
|
|
[Fuehrungsanteil] [float] NULL ,
|
|
[Soll_Zeit] [float] NOT NULL ,
|
|
[abwesenheiten] [float] NOT NULL ,
|
|
[CTB] [float] NULL ,
|
|
[RTB] [float] NULL
|
|
)
|
|
|
|
INSERT @an4
|
|
EXEC dbo.sp_rpt_AN_4_Summary @von = @von, @bis = @bis,
|
|
@oestruktur = @oestruktur,
|
|
@struktur_Ausschluss = @struktur_ausschluss,
|
|
@honoris_ausschluss = @honoris_ausschluss
|
|
UPDATE @an4
|
|
SET Soll_Zeit = ROUND(Soll_Zeit / 100 * Pensum, 2)
|
|
|
|
|
|
DECLARE @p FLOAT
|
|
DECLARE @s FLOAT
|
|
DECLARE @f FLOAT
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT tgnummer
|
|
FROM @planaufwand
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @p = Pensum ,
|
|
@s = SUM(Soll) ,
|
|
@f = Fuehrungsanteil
|
|
FROM @an4
|
|
GROUP BY tgnummer ,
|
|
Pensum ,
|
|
Fuehrungsanteil
|
|
HAVING ( tgnummer = @tgnummer )
|
|
|
|
|
|
SELECT @rtb_anteil = dbo.MADetails.Planwert_Anteil_RTB_Person
|
|
FROM dbo.MA INNER JOIN
|
|
dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr where ma.TGNummer=@tgnummer
|
|
|
|
|
|
--SELECT @rtb_anteil = rtbanteil
|
|
--FROM dbo.MADetail_RTB
|
|
--WHERE TGNummer = @tgnummer
|
|
UPDATE @planaufwand
|
|
SET soll_az = @s ,
|
|
fhr_anteil = @f ,
|
|
abwesenheiten = @abwesenheit_anteil ,
|
|
rtb = @rtb_anteil ,
|
|
pensum = @p
|
|
WHERE tgnummer = @tgnummer
|
|
|
|
|
|
FETCH NEXT FROM xx INTO @tgnummer
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
UPDATE @planaufwand
|
|
SET pt_fhranteil = soll_az / 100 * fhr_anteil ,
|
|
pt_abwesenheiten = soll_az / 100 * abwesenheiten ,
|
|
pt_rtb = soll_az / 100 * rtb
|
|
|
|
-- ****************************************************************************
|
|
-- Ressourcen ohne AN-Zuordnung
|
|
-- ****************************************************************************
|
|
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
Vorhaben VARCHAR(255) ,
|
|
Std [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Soll_Zeit FLOAT NOT NULL ,
|
|
JJMM VARCHAR(255) ,
|
|
pensum FLOAT NULL
|
|
)
|
|
|
|
DECLARE @tmpb TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
Pensum VARCHAR(255) ,
|
|
Soll_Zeit FLOAT NOT NULL ,
|
|
Std_Geleistet [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Abwesenheiten FLOAT NOT NULL ,
|
|
JJMM VARCHAR(255)
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer ,
|
|
madetails.OENr ,
|
|
ma.sortierung ,
|
|
@von ,
|
|
@bis ,
|
|
'' ,
|
|
madetails.Engagement ,
|
|
dbo.get_anteil(engagement,
|
|
MitarbeiterTypNr) ,
|
|
dbo.get_plantage(YEAR(@von),
|
|
MONTH(@von)) ,
|
|
'' ,
|
|
madetails.Engagement
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE @anzahl FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
|
|
|
|
UPDATE @tmpa
|
|
SET jjmm = LTRIM(STR(YEAR(start))) + '' +
|
|
LTRIM(STR(MONTH(start)))
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE ,
|
|
dbo.OE.Sortierung AS OESort ,
|
|
dbo.MA.Name ,
|
|
dbo.MA.Vorname ,
|
|
dbo.MA.Sortierung ,
|
|
a.TGNummer ,
|
|
a.START ,
|
|
a.ende ,
|
|
a.sortierung AS Expr1 ,
|
|
a.vorhaben ,
|
|
a.Std ,
|
|
a.Engagement_Effektiv ,
|
|
a.Soll_Zeit ,
|
|
a.JJMM ,
|
|
a.pensum
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN (
|
|
SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN (
|
|
SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
|
|
|
|
DELETE FROM #tmpfhr
|
|
WHERE tgnummer IN ( SELECT tgnummer
|
|
FROM @planaufwand )
|
|
DECLARE @pe FLOAT
|
|
DECLARE xv CURSOR
|
|
FOR
|
|
SELECT DISTINCT
|
|
tgnummer
|
|
FROM #tmpfhr
|
|
OPEN xv
|
|
FETCH NEXT FROM xv INTO @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @p = engagement_effektiv ,
|
|
@s = SUM(Soll_zeit) / 100 * std ,
|
|
@f = ( 100 - ( 100 / std * engagement_effektiv ) ) ,
|
|
@pe = pensum
|
|
FROM #tmpfhr
|
|
GROUP BY tgnummer ,
|
|
engagement_effektiv ,
|
|
std ,
|
|
pensum
|
|
HAVING ( tgnummer = @tgnummer )
|
|
|
|
--SELECT @rtb_anteil = rtbanteil
|
|
--FROM dbo.MADetail_RTB
|
|
--WHERE tgnummer = @tgnummer
|
|
|
|
SELECT @rtb_anteil = dbo.MADetails.Planwert_Anteil_RTB_Person
|
|
FROM dbo.MA INNER JOIN
|
|
dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr where ma.TGNummer=@tgnummer
|
|
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
TicketID ,
|
|
STATUS ,
|
|
Bereich ,
|
|
Aufwand ,
|
|
geleistet ,
|
|
noch_zu_leisten ,
|
|
noch_zu_leisten_1 ,
|
|
g_start ,
|
|
g_erledigung ,
|
|
SOLL_AZ ,
|
|
Fhr_Anteil ,
|
|
Abwesenheiten ,
|
|
RTB ,
|
|
pt_fhranteil ,
|
|
pt_abwesenheiten ,
|
|
pt_rtb ,
|
|
pensum
|
|
)
|
|
VALUES ( @tgnummer ,
|
|
'' ,
|
|
'' ,
|
|
'' ,
|
|
0 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
GETDATE() ,
|
|
GETDATE() ,
|
|
@s ,
|
|
@f ,
|
|
@abwesenheit_anteil ,
|
|
@rtb_anteil ,
|
|
NULL ,
|
|
NULL ,
|
|
NULL ,
|
|
@pe
|
|
)
|
|
FETCH NEXT FROM xv INTO @tgnummer
|
|
END
|
|
CLOSE xv
|
|
DEALLOCATE xv
|
|
|
|
UPDATE @planaufwand
|
|
SET kurzbeschreibung = a.Kurzbeschreibung
|
|
FROM @planaufwand
|
|
INNER JOIN shu_view_an_excelexport_lst a ON fullid = ticketid
|
|
|
|
UPDATE @planaufwand
|
|
SET pt_fhranteil = soll_az / 100 * fhr_anteil ,
|
|
pt_abwesenheiten = soll_az / 100 * abwesenheiten ,
|
|
pt_rtb = soll_az / 100 * rtb
|
|
|
|
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE ,
|
|
dbo.OE.Sortierung AS OESort ,
|
|
dbo.MA.Name ,
|
|
dbo.MA.Vorname ,
|
|
dbo.MA.Sortierung ,
|
|
a.TGNummer ,
|
|
a.START ,
|
|
a.ende ,
|
|
a.sortierung AS Expr1 ,
|
|
a.vorhaben ,
|
|
a.Std ,
|
|
a.Engagement_Effektiv ,
|
|
a.Soll_Zeit ,
|
|
a.JJMM
|
|
INTO #tmpfhr1
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN (
|
|
SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN (
|
|
SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
|
|
|
|
|
|
SELECT a.* ,
|
|
oe ,
|
|
oesort ,
|
|
sortierung ,
|
|
name ,
|
|
vorname
|
|
INTO #a
|
|
FROM @planaufwand a
|
|
INNER JOIN #tmpfhr1 ON a.TGNummer = #tmpfhr1.TGNummer
|
|
--DROP TABLE _an_03
|
|
|
|
DELETE FROM #a
|
|
WHERE ( g_erledigung IS NULL
|
|
AND TicketID <> ''
|
|
)
|
|
OR ( STATUS = 'abgelehnt' )
|
|
--delete from #a where (g_start
|
|
|
|
|
|
SELECT DISTINCT
|
|
*
|
|
INTO #b
|
|
FROM #a
|
|
|
|
DECLARE @tg VARCHAR(255) ,
|
|
@it INT ,
|
|
@tga VARCHAR(255) ,
|
|
@pp1 FLOAT ,
|
|
@pp2 FLOAT ,
|
|
@pp3 FLOAT ,
|
|
@pp4 FLOAT ,
|
|
@pp5 FLOAT ,
|
|
@SUM_WE FLOAT ,
|
|
@sum_delta FLOAT
|
|
SET @it = 0
|
|
SET @tga = ''
|
|
ALTER TABLE #b ADD idtemp INT IDENTITY(1,1)
|
|
ALTER TABLE #b ADD SUM_WE FLOAT
|
|
ALTER TABLE #b ADD SUM_Delta FLOAT
|
|
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT tgnummer ,
|
|
pt_fhranteil ,
|
|
pt_abwesenheiten ,
|
|
pt_rtb ,
|
|
idtemp ,
|
|
soll_az
|
|
FROM #b
|
|
ORDER BY tgnummer ,
|
|
g_erledigung asc,
|
|
ticketid desc
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @tg, @pp1, @pp2, @pp3, @pp4, @pp5
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
IF @tg <> @tga
|
|
BEGIN
|
|
PRINT @tg
|
|
UPDATE #b
|
|
SET pt_abwesenheiten = 0
|
|
WHERE tgnummer = @tg
|
|
UPDATE #b
|
|
SET pt_fhranteil = 0
|
|
WHERE tgnummer = @tg
|
|
UPDATE #b
|
|
SET pt_rtb = 0
|
|
WHERE tgnummer = @tg
|
|
UPDATE #b
|
|
SET soll_az = 0
|
|
WHERE tgnummer = @tg
|
|
SELECT @SUM_WE = SUM(noch_zu_leisten_1)
|
|
FROM #b
|
|
WHERE tgnummer = @tg
|
|
|
|
SET @sum_WE = @sum_we + ( @pp1 + @pp2 + @pp3 )
|
|
SET @sum_delta = @pp5 - @sum_we
|
|
|
|
UPDATE #b
|
|
SET soll_az = @pp5 ,
|
|
pt_fhranteil = @pp1 ,
|
|
pt_abwesenheiten = @pp2 ,
|
|
pt_rtb = @pp3 ,
|
|
sum_we = @sum_we ,
|
|
sum_delta = @sum_delta
|
|
WHERE idtemp = @pp4
|
|
|
|
SET @tga = @tg
|
|
END
|
|
FETCH NEXT FROM xc INTO @tg, @pp1, @pp2, @pp3, @pp4, @pp5
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
ALTER TABLE #b DROP COLUMN idtemp
|
|
|
|
--select * from #b where Name='Breitler' order by g_erledigung desc, TicketID asc
|
|
--return
|
|
--DROP TABLE _an_03
|
|
IF @ibereich <> ''
|
|
SELECT DISTINCT
|
|
*
|
|
FROM #b
|
|
WHERE bereich = @ibereich
|
|
ORDER BY g_erledigung desc,
|
|
TicketID asc
|
|
ELSE
|
|
SELECT DISTINCT
|
|
*
|
|
--INTO _an_03
|
|
FROM #b
|
|
ORDER BY g_erledigung desc,
|
|
TicketID asc
|
|
DROP TABLE #a
|
|
DROP TABLE #b
|
|
DROP TABLE #tmpfhr
|
|
DROP TABLE #tmpfhr1
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_AN_31] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_AN_31]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL ,
|
|
@iBereich VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @rtb_anteil INT
|
|
DECLARE @abwesenheit_anteil INT
|
|
|
|
SET @rtb_anteil = 30
|
|
SET @abwesenheit_anteil = 15
|
|
|
|
IF @ibereich IS NULL
|
|
SET @ibereich = ''
|
|
IF @von IS NULL
|
|
SET @von = '2015-01-01 00:00:00'
|
|
IF @bis IS NULL
|
|
SET @bis = '2015-03-31 00:00:00'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 42
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
|
|
|
|
|
|
-- ****************************************************************************
|
|
-- Planaufwand der AN_Tickets auslesen
|
|
--****************************************************************************
|
|
DECLARE @planaufwand TABLE
|
|
(
|
|
tgnummer VARCHAR(255) ,
|
|
TicketID VARCHAR(55) ,
|
|
Kurzbeschreibung VARCHAR(1024) NULL ,
|
|
STATUS VARCHAR(255) ,
|
|
Bereich VARCHAR(255) ,
|
|
Aufwand INT ,
|
|
Aufwand_P INT ,
|
|
Aufwand_A INT ,
|
|
geleistet FLOAT ,
|
|
noch_zu_leisten FLOAT ,
|
|
noch_zu_leisten_P FLOAT NULL ,
|
|
noch_zu_leisten_A FLOAT NULL ,
|
|
noch_zu_leisten_1 FLOAT NULL ,
|
|
noch_zu_leisten_1P FLOAT NULL ,
|
|
noch_zu_leisten_1A FLOAT NULL ,
|
|
g_start DATETIME ,
|
|
g_erledigung DATETIME ,
|
|
SOLL_AZ FLOAT NULL ,
|
|
Fhr_Anteil FLOAT NULL ,
|
|
Abwesenheiten FLOAT NULL ,
|
|
RTB FLOAT NULL ,
|
|
pt_fhranteil FLOAT NULL ,
|
|
pt_abwesenheiten FLOAT NULL ,
|
|
pt_rtb FLOAT NULL ,
|
|
Pensum FLOAT NULL,
|
|
Projekt VARCHAR(255) null
|
|
)
|
|
|
|
DECLARE @ticketid VARCHAR(255) ,
|
|
@tgnummer VARCHAR(255) ,
|
|
@g_erledigung DATETIME ,
|
|
@g_start DATETIME ,
|
|
@status VARCHAR(255) ,
|
|
@bereich VARCHAR(255)
|
|
DECLARE @ma1 VARCHAR(255) ,
|
|
@p1 INT ,
|
|
@ma2 VARCHAR(255) ,
|
|
@p2 INT ,
|
|
@ma3 VARCHAR(255) ,
|
|
@p3 INT ,
|
|
@ma4 VARCHAR(255) ,
|
|
@p4 INT ,
|
|
@ma5 VARCHAR(255) ,
|
|
@p5 INT
|
|
DECLARE @ma6 VARCHAR(255) ,
|
|
@p6 INT ,
|
|
@ma7 VARCHAR(255) ,
|
|
@p7 INT ,
|
|
@ma8 VARCHAR(255) ,
|
|
@p8 INT ,
|
|
@ma9 VARCHAR(255) ,
|
|
@p9 INT
|
|
DECLARE @pos1 INT
|
|
DECLARE @pos2 INT
|
|
DECLARE @x VARCHAR(255)
|
|
DECLARE @y INT
|
|
DECLARE @yy VARCHAR(255)
|
|
DECLARE @mm VARCHAR(255)
|
|
DECLARE @tt VARCHAR(255)
|
|
DECLARE @ap VARCHAR(255)
|
|
DECLARE @pa INT
|
|
DECLARE @aa INT
|
|
|
|
|
|
|
|
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT DISTINCT
|
|
fullid ,
|
|
mitarbeiter_1 ,
|
|
planaufwand_1 ,
|
|
mitarbeiter_2 ,
|
|
planaufwand_2 ,
|
|
mitarbeiter_3 ,
|
|
planaufwand_3 ,
|
|
mitarbeiter_4 ,
|
|
planaufwand_4 ,
|
|
mitarbeiter_5 ,
|
|
planaufwand_5 ,
|
|
mitarbeiter_6 ,
|
|
planaufwand_6 ,
|
|
mitarbeiter_7 ,
|
|
planaufwand_7 ,
|
|
mitarbeiter_8 ,
|
|
planaufwand_8 ,
|
|
mitarbeiter_9 ,
|
|
planaufwand_9 ,
|
|
Geplantes_Erledigungsdatum ,
|
|
Geplantes_Startdatum AS Geplantes_Startdatum ,
|
|
Status ,
|
|
Bereich ,
|
|
ausloeser_projekt
|
|
FROM dbo.shu_view_an_excelexport_lst
|
|
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @ticketid, @ma1, @p1, @ma2, @p2, @ma3, @p3,
|
|
@ma4, @p4, @ma5, @p5, @ma6, @p6, @ma7, @p7, @ma8, @p8, @ma9, @p9,
|
|
@g_erledigung, @g_start, @status, @bereich, @ap
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
IF NOT @g_erledigung IS NULL
|
|
BEGIN
|
|
SET @yy = YEAR(@g_erledigung)
|
|
SET @mm = MONTH(@g_erledigung)
|
|
SET @tt = DAY(@g_erledigung)
|
|
SET @g_erledigung = @tt + '.' + @mm + '.' + @yy
|
|
+ ' 00:00:00'
|
|
SET @g_erledigung = DATEADD(DAY, 1, @g_erledigung)
|
|
END
|
|
IF NOT @g_start IS NULL
|
|
BEGIN
|
|
SET @yy = YEAR(@g_start)
|
|
SET @mm = MONTH(@g_start)
|
|
SET @tt = DAY(@g_start)
|
|
SET @g_start = @tt + '.' + @mm + '.' + @yy
|
|
+ ' 00:00:00'
|
|
SET @g_start = DATEADD(DAY, 1, @g_start)
|
|
END
|
|
|
|
|
|
|
|
IF LEN(@ma1) > 0
|
|
BEGIN
|
|
SET @x = @ma1
|
|
SET @y = @p1
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma2) > 0
|
|
BEGIN
|
|
SET @x = @ma2
|
|
SET @y = @p2
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma3) > 0
|
|
BEGIN
|
|
SET @x = @ma3
|
|
SET @y = @p3
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma4) > 0
|
|
BEGIN
|
|
SET @x = @ma4
|
|
SET @y = @p4
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma5) > 0
|
|
BEGIN
|
|
SET @x = @ma5
|
|
SET @y = @p5
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma6) > 0
|
|
BEGIN
|
|
SET @x = @ma6
|
|
SET @y = @p6
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma7) > 0
|
|
BEGIN
|
|
SET @x = @ma7
|
|
SET @y = @p7
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
END
|
|
END
|
|
IF LEN(@ma8) > 0
|
|
BEGIN
|
|
SET @x = @ma8
|
|
SET @y = @p8
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
|
|
END
|
|
END
|
|
IF LEN(@ma9) > 0
|
|
BEGIN
|
|
SET @x = @ma9
|
|
SET @y = @p9
|
|
SET @pos1 = 0
|
|
SET @pos2 = 0
|
|
SET @pos1 = CHARINDEX('(', @x)
|
|
SET @pos2 = CHARINDEX(')', @x)
|
|
IF @ap = 'Ja'
|
|
BEGIN
|
|
SET @pa = @y
|
|
SET @aa = 0
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @pa = 0
|
|
SET @aa = @y
|
|
END
|
|
IF @pos1 > 0
|
|
AND @pos2 > 0
|
|
BEGIN
|
|
SET @pos1 = @pos1 + 1
|
|
SET @x = SUBSTRING(@x, @pos1, @pos2 - @pos1)
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
VALUES ( @x ,
|
|
@ticketid ,
|
|
@y ,
|
|
@pa ,
|
|
@aa ,
|
|
@g_erledigung ,
|
|
@g_start ,
|
|
@status ,
|
|
@bereich, @ap
|
|
)
|
|
|
|
END
|
|
END
|
|
FETCH NEXT FROM xx INTO @ticketid, @ma1, @p1, @ma2, @p2, @ma3,
|
|
@p3, @ma4, @p4, @ma5, @p5, @ma6, @p6, @ma7, @p7, @ma8, @p8,
|
|
@ma9, @p9, @g_erledigung, @g_start, @status, @bereich, @ap
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
-- ****************************************************************************
|
|
-- Ende Planaufwand der AN_Tickets auslesen
|
|
-- ****************************************************************************
|
|
insert @planaufwand
|
|
( tgnummer ,
|
|
ticketid ,
|
|
aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
status ,
|
|
bereich, Projekt
|
|
)
|
|
|
|
select ma.TGNummer,'',0,0,0,null,null,'','',0
|
|
FROM dbo.MA INNER JOIN
|
|
dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.OENr IN
|
|
(SELECT ID FROM dbo.fnkt_get_KPI_hierarchie(@oestruktur) AS fnkt_get_KPI_hierarchie_1)
|
|
-- and tgnummer not in (select tgnummer from #ttg)
|
|
|
|
-- ****************************************************************************
|
|
-- Geleistete, noch zu leistende Tage
|
|
-- ****************************************************************************
|
|
|
|
UPDATE @planaufwand
|
|
SET geleistet = 0.00 ,
|
|
noch_zu_leisten = 00
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT [Ticket_ID] ,
|
|
[ForUserID] ,
|
|
[CalculatedValue]
|
|
FROM TXP_LVer_IN_AU
|
|
WHERE ticket_id LIKE 'AN%'
|
|
AND [Statusdatum] < @von
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @y
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
UPDATE @planaufwand
|
|
SET geleistet = geleistet + @y
|
|
WHERE tgnummer = @tgnummer
|
|
AND ticketid = @ticketid
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @y
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
UPDATE @planaufwand
|
|
SET geleistet = ROUND(geleistet / 8, 2)
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten = aufwand - geleistet ,
|
|
noch_zu_leisten_p = aufwand_p - geleistet ,
|
|
noch_zu_leisten_a = aufwand_a - geleistet
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1 = 0.00 ,
|
|
noch_zu_leisten_1a = 0.00 ,
|
|
noch_zu_leisten_1p = 0.00
|
|
DELETE FROM @planaufwand
|
|
WHERE g_start > @bis
|
|
DELETE FROM @planaufwand
|
|
WHERE g_erledigung < @von
|
|
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1 = noch_zu_leisten ,
|
|
noch_zu_leisten_1p = noch_zu_leisten_p ,
|
|
noch_zu_leisten_1a = noch_zu_leisten_a
|
|
|
|
DECLARE @gp_dauer FLOAT
|
|
DECLARE @rn_dauer FLOAT
|
|
DECLARE @faktor FLOAT
|
|
|
|
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT ticketid ,
|
|
tgnummer ,
|
|
g_erledigung ,
|
|
g_start ,
|
|
noch_zu_leisten
|
|
FROM @planaufwand
|
|
WHERE g_erledigung > @bis
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @g_erledigung, @g_start,
|
|
@y
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SET @gp_dauer = DATEDIFF(DAY, @g_start, @g_erledigung)
|
|
IF @g_start <= @von
|
|
SET @gp_dauer = DATEDIFF(day, @von, @g_erledigung)
|
|
IF @g_start > @von
|
|
BEGIN
|
|
SET @rn_dauer = DATEDIFF(DAY, @g_start, @bis)
|
|
END
|
|
ELSE
|
|
BEGIN
|
|
SET @rn_dauer = DATEDIFF(DAY, @von, @bis)
|
|
END
|
|
SET @faktor = @rn_dauer / @gp_dauer
|
|
|
|
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1 = ROUND(noch_zu_leisten_1
|
|
* ( @rn_dauer / @gp_dauer ),
|
|
2)
|
|
WHERE ticketid = @ticketid
|
|
AND tgnummer = @tgnummer
|
|
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1p = ROUND(noch_zu_leisten_1p
|
|
* ( @rn_dauer / @gp_dauer ),
|
|
2)
|
|
WHERE ticketid = @ticketid
|
|
AND tgnummer = @tgnummer
|
|
|
|
UPDATE @planaufwand
|
|
SET noch_zu_leisten_1a = ROUND(noch_zu_leisten_1a
|
|
* ( @rn_dauer / @gp_dauer ),
|
|
2)
|
|
WHERE ticketid = @ticketid
|
|
AND tgnummer = @tgnummer
|
|
|
|
FETCH NEXT FROM xx INTO @ticketid, @tgnummer, @g_erledigung,
|
|
@g_start, @y
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
--****************************************************************************
|
|
-- Ende Geleistete, noch zu leistende Tage
|
|
-- ****************************************************************************
|
|
|
|
DECLARE @an4 TABLE
|
|
(
|
|
[JJMM] [varchar](255) NULL ,
|
|
[OE] [varchar](50) NULL ,
|
|
[OESort] [int] NULL ,
|
|
[tgnummer] [varchar](50) NULL ,
|
|
[Name] [varchar](50) NULL ,
|
|
[Vorname] [varchar](50) NULL ,
|
|
[Sortierung] [int] NULL ,
|
|
[START] [datetime] NULL ,
|
|
[ende] [datetime] NULL ,
|
|
[Sort] [int] NULL ,
|
|
[Pensum] [varchar](255) NULL ,
|
|
[Soll] [float] NULL ,
|
|
[Geleistet] [float] NOT NULL ,
|
|
[Engagement_Effektiv] [float] NOT NULL ,
|
|
[Fuehrungsanteil] [float] NULL ,
|
|
[Soll_Zeit] [float] NOT NULL ,
|
|
[abwesenheiten] [float] NOT NULL ,
|
|
[CTB] [float] NULL ,
|
|
[RTB] [float] NULL
|
|
)
|
|
|
|
INSERT @an4
|
|
EXEC dbo.sp_rpt_AN_4_Summary @von = @von, @bis = @bis,
|
|
@oestruktur = @oestruktur,
|
|
@struktur_Ausschluss = @struktur_ausschluss,
|
|
@honoris_ausschluss = @honoris_ausschluss
|
|
UPDATE @an4
|
|
SET Soll_Zeit = ROUND(Soll_Zeit / 100 * Pensum, 2)
|
|
|
|
|
|
|
|
DECLARE @p FLOAT
|
|
DECLARE @s FLOAT
|
|
DECLARE @f FLOAT
|
|
DECLARE xx CURSOR
|
|
FOR
|
|
SELECT tgnummer
|
|
FROM @planaufwand
|
|
OPEN xx
|
|
FETCH NEXT FROM xx INTO @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @p = Pensum ,
|
|
@s = SUM(Soll) ,
|
|
@f = Fuehrungsanteil
|
|
FROM @an4
|
|
GROUP BY tgnummer ,
|
|
Pensum ,
|
|
Fuehrungsanteil
|
|
HAVING ( tgnummer = @tgnummer )
|
|
|
|
SELECT @rtb_anteil = dbo.MADetails.Planwert_Anteil_RTB_Person
|
|
FROM dbo.MA INNER JOIN
|
|
dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr where ma.TGNummer=@tgnummer
|
|
UPDATE @planaufwand
|
|
SET soll_az = @s ,
|
|
fhr_anteil = @f ,
|
|
abwesenheiten = @abwesenheit_anteil ,
|
|
rtb = @rtb_anteil ,
|
|
pensum = @p
|
|
WHERE tgnummer = @tgnummer
|
|
|
|
|
|
FETCH NEXT FROM xx INTO @tgnummer
|
|
END
|
|
CLOSE xx
|
|
DEALLOCATE xx
|
|
UPDATE @planaufwand
|
|
SET pt_fhranteil = soll_az / 100 * fhr_anteil ,
|
|
pt_abwesenheiten = soll_az / 100 * abwesenheiten ,
|
|
pt_rtb = soll_az / 100 * rtb
|
|
|
|
-- ****************************************************************************
|
|
-- Ressourcen ohne AN-Zuordnung
|
|
-- ****************************************************************************
|
|
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
Vorhaben VARCHAR(255) ,
|
|
Std [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Soll_Zeit FLOAT NOT NULL ,
|
|
JJMM VARCHAR(255) ,
|
|
pensum FLOAT NULL
|
|
)
|
|
|
|
DECLARE @tmpb TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
Pensum VARCHAR(255) ,
|
|
Soll_Zeit FLOAT NOT NULL ,
|
|
Std_Geleistet [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Abwesenheiten FLOAT NOT NULL ,
|
|
JJMM VARCHAR(255)
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer ,
|
|
madetails.OENr ,
|
|
ma.sortierung ,
|
|
@von ,
|
|
@bis ,
|
|
'' ,
|
|
madetails.Engagement ,
|
|
dbo.get_anteil(engagement,
|
|
MitarbeiterTypNr) ,
|
|
dbo.get_plantage(YEAR(@von),
|
|
MONTH(@von)) ,
|
|
'' ,
|
|
madetails.Engagement
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE @anzahl FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
|
|
|
|
UPDATE @tmpa
|
|
SET jjmm = LTRIM(STR(YEAR(start))) + '' +
|
|
LTRIM(STR(MONTH(start)))
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE ,
|
|
dbo.OE.Sortierung AS OESort ,
|
|
dbo.MA.Name ,
|
|
dbo.MA.Vorname ,
|
|
dbo.MA.Sortierung ,
|
|
a.TGNummer ,
|
|
a.START ,
|
|
a.ende ,
|
|
a.sortierung AS Expr1 ,
|
|
a.vorhaben ,
|
|
a.Std ,
|
|
a.Engagement_Effektiv ,
|
|
a.Soll_Zeit ,
|
|
a.JJMM ,
|
|
a.pensum
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN (
|
|
SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN (
|
|
SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
|
|
|
|
DELETE FROM #tmpfhr
|
|
WHERE tgnummer IN ( SELECT tgnummer
|
|
FROM @planaufwand )
|
|
DECLARE @pe FLOAT
|
|
DECLARE xv CURSOR
|
|
FOR
|
|
SELECT DISTINCT
|
|
tgnummer
|
|
FROM #tmpfhr
|
|
OPEN xv
|
|
FETCH NEXT FROM xv INTO @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @p = engagement_effektiv ,
|
|
@s = SUM(Soll_zeit) / 100 * std ,
|
|
@f = ( 100 - ( 100 / std * engagement_effektiv ) ) ,
|
|
@pe = pensum
|
|
FROM #tmpfhr
|
|
GROUP BY tgnummer ,
|
|
engagement_effektiv ,
|
|
std ,
|
|
pensum
|
|
HAVING ( tgnummer = @tgnummer )
|
|
|
|
SELECT @rtb_anteil = dbo.MADetails.Planwert_Anteil_RTB_Person
|
|
FROM dbo.MA INNER JOIN
|
|
dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr where ma.TGNummer=@tgnummer
|
|
INSERT @planaufwand
|
|
( tgnummer ,
|
|
TicketID ,
|
|
STATUS ,
|
|
Bereich ,
|
|
Aufwand ,
|
|
Aufwand_P ,
|
|
Aufwand_A ,
|
|
geleistet ,
|
|
noch_zu_leisten ,
|
|
noch_zu_leisten_p ,
|
|
noch_zu_leisten_a ,
|
|
noch_zu_leisten_1 ,
|
|
noch_zu_leisten_1p ,
|
|
noch_zu_leisten_1a ,
|
|
g_start ,
|
|
g_erledigung ,
|
|
SOLL_AZ ,
|
|
Fhr_Anteil ,
|
|
Abwesenheiten ,
|
|
RTB ,
|
|
pt_fhranteil ,
|
|
pt_abwesenheiten ,
|
|
pt_rtb ,
|
|
pensum,projekt
|
|
)
|
|
VALUES ( @tgnummer ,
|
|
'' ,
|
|
'' ,
|
|
'' ,
|
|
0 ,
|
|
0 ,
|
|
0 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
0.00 ,
|
|
GETDATE() ,
|
|
GETDATE() ,
|
|
@s ,
|
|
@f ,
|
|
@abwesenheit_anteil ,
|
|
@rtb_anteil ,
|
|
NULL ,
|
|
NULL ,
|
|
NULL ,
|
|
@pe,''
|
|
)
|
|
FETCH NEXT FROM xv INTO @tgnummer
|
|
END
|
|
CLOSE xv
|
|
DEALLOCATE xv
|
|
|
|
UPDATE @planaufwand
|
|
SET kurzbeschreibung = a.Kurzbeschreibung
|
|
FROM @planaufwand
|
|
INNER JOIN shu_view_an_excelexport_lst a ON fullid = ticketid
|
|
|
|
UPDATE @planaufwand
|
|
SET pt_fhranteil = soll_az / 100 * fhr_anteil ,
|
|
pt_abwesenheiten = soll_az / 100 * abwesenheiten ,
|
|
pt_rtb = soll_az / 100 * rtb
|
|
|
|
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE ,
|
|
dbo.OE.Sortierung AS OESort ,
|
|
dbo.MA.Name ,
|
|
dbo.MA.Vorname ,
|
|
dbo.MA.Sortierung ,
|
|
a.TGNummer ,
|
|
a.START ,
|
|
a.ende ,
|
|
a.sortierung AS Expr1 ,
|
|
a.vorhaben ,
|
|
a.Std ,
|
|
a.Engagement_Effektiv ,
|
|
a.Soll_Zeit ,
|
|
a.JJMM
|
|
INTO #tmpfhr1
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN (
|
|
SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN (
|
|
SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
|
|
|
|
|
|
SELECT a.* ,
|
|
oe ,
|
|
oesort ,
|
|
sortierung ,
|
|
name ,
|
|
vorname
|
|
INTO #a
|
|
FROM @planaufwand a
|
|
INNER JOIN #tmpfhr1 ON a.TGNummer = #tmpfhr1.TGNummer
|
|
--DROP TABLE _an_03
|
|
|
|
DELETE FROM #a
|
|
WHERE ( g_erledigung IS NULL
|
|
AND TicketID <> ''
|
|
)
|
|
OR ( STATUS = 'abgelehnt' )
|
|
--delete from #a where (g_start
|
|
|
|
|
|
SELECT DISTINCT
|
|
*
|
|
INTO #b
|
|
FROM #a
|
|
|
|
DECLARE @tg VARCHAR(255) ,
|
|
@it INT ,
|
|
@tga VARCHAR(255) ,
|
|
@pp1 FLOAT ,
|
|
@pp2 FLOAT ,
|
|
@pp3 FLOAT ,
|
|
@pp4 FLOAT ,
|
|
@pp5 FLOAT ,
|
|
@SUM_WE FLOAT ,
|
|
@sum_delta FLOAT
|
|
SET @it = 0
|
|
SET @tga = ''
|
|
ALTER TABLE #b ADD idtemp INT IDENTITY(1,1)
|
|
ALTER TABLE #b ADD SUM_WE FLOAT
|
|
ALTER TABLE #b ADD SUM_Delta FLOAT
|
|
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT tgnummer ,
|
|
pt_fhranteil ,
|
|
pt_abwesenheiten ,
|
|
pt_rtb ,
|
|
idtemp ,
|
|
soll_az
|
|
FROM #b
|
|
ORDER BY tgnummer ,
|
|
g_erledigung ASC ,
|
|
ticketid DESC
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @tg, @pp1, @pp2, @pp3, @pp4, @pp5
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
IF @tg <> @tga
|
|
BEGIN
|
|
PRINT @tg
|
|
UPDATE #b
|
|
SET pt_abwesenheiten = 0
|
|
WHERE tgnummer = @tg
|
|
UPDATE #b
|
|
SET pt_fhranteil = 0
|
|
WHERE tgnummer = @tg
|
|
UPDATE #b
|
|
SET pt_rtb = 0
|
|
WHERE tgnummer = @tg
|
|
UPDATE #b
|
|
SET soll_az = 0
|
|
WHERE tgnummer = @tg
|
|
SELECT @SUM_WE = SUM(noch_zu_leisten_1)
|
|
FROM #b
|
|
WHERE tgnummer = @tg
|
|
|
|
SET @sum_WE = @sum_we + ( @pp1 + @pp2 + @pp3 )
|
|
SET @sum_delta = @pp5 - @sum_we
|
|
|
|
UPDATE #b
|
|
SET soll_az = @pp5 ,
|
|
pt_fhranteil = @pp1 ,
|
|
pt_abwesenheiten = @pp2 ,
|
|
pt_rtb = @pp3 ,
|
|
sum_we = @sum_we ,
|
|
sum_delta = @sum_delta
|
|
WHERE idtemp = @pp4
|
|
|
|
SET @tga = @tg
|
|
END
|
|
FETCH NEXT FROM xc INTO @tg, @pp1, @pp2, @pp3, @pp4, @pp5
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
ALTER TABLE #b DROP COLUMN idtemp
|
|
|
|
--select * from #b where Name='Breitler' order by g_erledigung desc, TicketID asc
|
|
--return
|
|
--DROP TABLE _an_03
|
|
UPDATE #b SET noch_zu_leisten_1p =0 WHERE noch_zu_leisten_1p <0
|
|
UPDATE #b SET noch_zu_leisten_1a =0 WHERE noch_zu_leisten_1a <0
|
|
UPDATE #b SET noch_zu_leisten_a =0 WHERE noch_zu_leisten_a <0
|
|
UPDATE #b SET noch_zu_leisten_p =0 WHERE noch_zu_leisten_p <0
|
|
update #b set sum_we=0 where sum_we is null
|
|
update #b set sum_delta=0 where sum_delta is null
|
|
update #b set kurzbeschreibung='' where kurzbeschreibung is null
|
|
|
|
|
|
|
|
|
|
|
|
IF @ibereich <> ''
|
|
SELECT DISTINCT
|
|
*
|
|
FROM #b
|
|
WHERE bereich = @ibereich
|
|
ORDER BY g_erledigung DESC ,
|
|
TicketID ASC
|
|
ELSE
|
|
SELECT DISTINCT
|
|
*
|
|
FROM #b
|
|
ORDER BY g_erledigung DESC ,
|
|
TicketID ASC
|
|
DROP TABLE #a
|
|
DROP TABLE #b
|
|
DROP TABLE #tmpfhr
|
|
DROP TABLE #tmpfhr1
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_AN_4] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_AN_4]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '2014-03-01 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '2014-03-31 23:59:59'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 42
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
declare @dd1 varchar(2)
|
|
declare @mm1 varchar(2)
|
|
declare @yy1 varchar(4)
|
|
declare @datum varchar(255)
|
|
set @dd1=DAY(@von)
|
|
set @mm1=MONTH(@von)
|
|
set @yy1=YEAR(@von)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 00:00:00'
|
|
set @von=convert(datetime,@datum,20)
|
|
set @dd1=DAY(@bis)
|
|
set @mm1=MONTH(@bis)
|
|
set @yy1=YEAR(@bis)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 22:48:45'
|
|
set @bis=convert(datetime,@datum,20)
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
Vorhaben VARCHAR(255),
|
|
Std [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Soll_Zeit FLOAT NOT NULL,
|
|
JJMM VARCHAR(255)
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
--IF @rc > 0
|
|
-- BEGIN
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, '',0.00,
|
|
dbo.get_anteil(engagement, MitarbeiterTypNr), dbo.get_plantage(YEAR(@von),MONTH(@von)),''
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
-- END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE @anzahl FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
|
|
UPDATE @tmpa SET jjmm = LTRIM(STR(YEAR(start)))+''+LTRIM(STR(MONTH(start)))
|
|
|
|
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
a.sortierung AS Expr1, a.vorhaben, a.Std, a.Engagement_Effektiv, a.Soll_Zeit,a.JJMM
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN ( SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
--select * from #tmpfhr where Name='stalder'
|
|
|
|
SELECT TGNummer, oe, sortierung, START, Ende, Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, LTRIM(STR(YEAR(start)))+''+LTRIM(STR(MONTH(start))) AS JJMM,
|
|
dbo.AN_Summe_Ticket_User.Ticket_ID, dbo.AN_Summe_Ticket_User.Expr1 AS Summe_Std, ROUND(dbo.AN_Summe_Ticket_User.Expr1 / 8, 2) AS Summe_Tage,
|
|
dbo.AN_Summe_Ticket_User.Kurzbeschreibung
|
|
INTO #tmpb
|
|
FROM #tmpfhr INNER JOIN
|
|
dbo.AN_Summe_Ticket_User ON TGNummer = dbo.AN_Summe_Ticket_User.ForUserID AND LTRIM(STR(YEAR(start)))+''+LTRIM(STR(MONTH(start))) = dbo.AN_Summe_Ticket_User.jjmm
|
|
|
|
|
|
SELECT DISTINCT
|
|
#tmpb.TGNummer, #tmpb.oe, #tmpb.sortierung, #tmpb.START,
|
|
#tmpb.Ende, #tmpb.Vorhaben, #tmpb.Std, #tmpb.Engagement_Effektiv,
|
|
#tmpb.Soll_Zeit, #tmpb.JJMM, #tmpb.Ticket_ID, #tmpb.Summe_Std,
|
|
#tmpb.Summe_Tage, #tmpb.Kurzbeschreibung, dbo.MA.TGNummer AS Expr1, dbo.MA.Name, dbo.MA.Vorname
|
|
|
|
INTO #tmpx
|
|
FROM #tmpb INNER JOIN
|
|
dbo.shu_view_an_excelexport_lst ON #tmpb.Ticket_ID = dbo.shu_view_an_excelexport_lst.FullId INNER JOIN
|
|
dbo.MA ON #tmpb.TGNummer = dbo.MA.TGNummer
|
|
|
|
|
|
|
|
|
|
-- Honoris
|
|
-- SELECT TGNummer, oenr, sortierung, START, Ende,
|
|
-- Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, JJMM AS JJMM, dbo.honoris_projekt.PROJEKT_NR, dbo.honoris_journal.ANZAHLINT AS Summe_Std,
|
|
-- dbo.honoris_projekt.KURZNAME
|
|
-- into #tmpc
|
|
-- FROM dbo.honoris_journal INNER JOIN
|
|
-- dbo.honoris_projekt ON dbo.honoris_journal.PROJEKT_NR = dbo.honoris_projekt.PROJEKT_NR INNER JOIN
|
|
-- dbo.Honoris_Mitarbeiter ON dbo.honoris_journal.MITARBEITER_NR = dbo.Honoris_Mitarbeiter.MITARBEITER_NR INNER JOIN
|
|
-- @tmpa ON dbo.Honoris_Mitarbeiter.MITARBEITER_ID = TGNummer AND LTRIM(STR(YEAR(dbo.honoris_journal.DATUM))) + LTRIM(STR(MONTH(dbo.honoris_journal.DATUM))) = JJMM
|
|
|
|
-- SELECT TGNummer, oenr, sortierung, START, Ende, Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, JJMM, PROJEKT_NR, SUM(Summe_Std) AS Summe_Std, ROUND(SUM(ROUND(Summe_Std / 8, 2)),2) AS Summe_Tage,
|
|
-- KURZNAME
|
|
-- INTO #tmpd
|
|
-- FROM #tmpc
|
|
-- GROUP BY TGNummer, oenr, sortierung, START, Ende, Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, JJMM, PROJEKT_NR, KURZNAME
|
|
|
|
|
|
|
|
-- SELECT TOP ( 100 ) PERCENT
|
|
-- dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
-- a.sortierung AS Expr1, a.vorhaben, a.Std, a.Engagement_Effektiv, a.Soll_Zeit,a.JJMM, a.PROJEKT_NR AS Ticket_ID, a.Summe_Std,ROUND(a.Summe_Tage,2) AS Summe_Tage,a.KURZNAME AS kurzbeschreibung
|
|
-- INTO #tmpe
|
|
-- FROM #tmpd a
|
|
-- INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
-- INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
-- WHERE dbo.OE.oenr IN ( SELECT id
|
|
-- FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- AND dbo.oe.oenr NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
-- ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
--INSERT #tmpx
|
|
-- SELECT DISTINCT
|
|
-- #tmpe.TGNummer, #tmpe.oe, #tmpe.sortierung, #tmpe.START,
|
|
-- #tmpe.Ende, #tmpe.Vorhaben, #tmpe.Std, #tmpe.Engagement_Effektiv,
|
|
-- #tmpe.Soll_Zeit, #tmpe.JJMM, #tmpe.Ticket_ID, #tmpe.Summe_Std,
|
|
-- ROUND(#tmpe.Summe_Tage,2) AS Summe_Tage, #tmpe.Kurzbeschreibung, dbo.MA.TGNummer AS Expr1, dbo.MA.Name, dbo.MA.Vorname
|
|
|
|
-- FROM #tmpe INNER JOIN
|
|
|
|
-- dbo.MA ON #tmpe.TGNummer = dbo.MA.TGNummer
|
|
|
|
|
|
-- DROP TABLE dbo._an_04
|
|
SELECT *
|
|
--INTO _an_04
|
|
FROM #tmpx
|
|
RETURN
|
|
|
|
drop table #tmpb
|
|
drop table #tmpx
|
|
drop table #tmpfhr
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_AN_4_Summary] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_AN_4_Summary]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '31.12.2013 23:59:59'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 42
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
declare @dd1 varchar(2)
|
|
declare @mm1 varchar(2)
|
|
declare @yy1 varchar(4)
|
|
declare @datum varchar(255)
|
|
set @dd1=DAY(@von)
|
|
set @mm1=MONTH(@von)
|
|
set @yy1=YEAR(@von)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 00:00:00'
|
|
set @von=convert(datetime,@datum,20)
|
|
set @dd1=DAY(@bis)
|
|
set @mm1=MONTH(@bis)
|
|
set @yy1=YEAR(@bis)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 22:48:45'
|
|
set @bis=convert(datetime,@datum,20)
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
Vorhaben VARCHAR(255),
|
|
Std [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Soll_Zeit FLOAT NOT NULL,
|
|
JJMM VARCHAR(255)
|
|
)
|
|
|
|
DECLARE @tmpb TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
Pensum VARCHAR(255),
|
|
Soll_Zeit FLOAT NOT NULL,
|
|
Std_Geleistet [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Abwesenheiten FLOAT NOT NULL,
|
|
JJMM VARCHAR(255)
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
--IF @rc > 0
|
|
-- BEGIN
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, '',0.00,
|
|
dbo.get_anteil(engagement, MitarbeiterTypNr), dbo.get_plantage(YEAR(@von),MONTH(@von)),''
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
INSERT @tmpb
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, madetails.Engagement,dbo.get_plantage(YEAR(@von),MONTH(@von)),
|
|
0.00, dbo.get_anteil(engagement, MitarbeiterTypNr), 0.00,
|
|
LTRIM(STR(YEAR(@von)))+''+LTRIM(STR(MONTH(@von)))
|
|
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
-- END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE @anzahl FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
|
|
UPDATE @tmpa SET jjmm = LTRIM(STR(YEAR(start)))+''+LTRIM(STR(MONTH(start)))
|
|
|
|
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
a.sortierung AS Expr1, a.vorhaben, a.Std, a.Engagement_Effektiv, a.Soll_Zeit,a.JJMM
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN ( SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
|
|
|
|
SELECT TGNummer, oe, sortierung, START, Ende, Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, LTRIM(STR(YEAR(start)))+''+LTRIM(STR(MONTH(start))) AS JJMM,
|
|
dbo.AN_Summe_Ticket_User.Ticket_ID, dbo.AN_Summe_Ticket_User.Expr1 AS Summe_Std, ROUND(dbo.AN_Summe_Ticket_User.Expr1 / 8, 2) AS Summe_Tage,
|
|
dbo.AN_Summe_Ticket_User.Kurzbeschreibung
|
|
INTO #tmpb
|
|
FROM #tmpfhr INNER JOIN
|
|
dbo.AN_Summe_Ticket_User ON TGNummer = dbo.AN_Summe_Ticket_User.ForUserID AND LTRIM(STR(YEAR(start)))+''+LTRIM(STR(MONTH(start))) = dbo.AN_Summe_Ticket_User.jjmm
|
|
|
|
|
|
SELECT DISTINCT
|
|
#tmpb.TGNummer, #tmpb.oe, #tmpb.sortierung, #tmpb.START,
|
|
#tmpb.Ende, #tmpb.Vorhaben, #tmpb.Std, #tmpb.Engagement_Effektiv,
|
|
#tmpb.Soll_Zeit, #tmpb.JJMM, #tmpb.Ticket_ID, #tmpb.Summe_Std,
|
|
#tmpb.Summe_Tage, #tmpb.Kurzbeschreibung, dbo.MA.TGNummer AS Expr1, dbo.MA.Name, dbo.MA.Vorname
|
|
|
|
INTO #tmpx
|
|
FROM #tmpb INNER JOIN
|
|
dbo.shu_view_an_excelexport_lst ON #tmpb.Ticket_ID = dbo.shu_view_an_excelexport_lst.FullId INNER JOIN
|
|
dbo.MA ON #tmpb.TGNummer = dbo.MA.TGNummer
|
|
|
|
|
|
|
|
|
|
-- Honoris
|
|
-- SELECT TGNummer, oenr, sortierung, START, Ende,
|
|
-- Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, JJMM AS JJMM, dbo.honoris_projekt.PROJEKT_NR, dbo.honoris_journal.ANZAHLINT AS Summe_Std,
|
|
-- dbo.honoris_projekt.KURZNAME
|
|
-- into #tmpc
|
|
-- FROM dbo.honoris_journal INNER JOIN
|
|
-- dbo.honoris_projekt ON dbo.honoris_journal.PROJEKT_NR = dbo.honoris_projekt.PROJEKT_NR INNER JOIN
|
|
-- dbo.Honoris_Mitarbeiter ON dbo.honoris_journal.MITARBEITER_NR = dbo.Honoris_Mitarbeiter.MITARBEITER_NR INNER JOIN
|
|
-- @tmpa ON dbo.Honoris_Mitarbeiter.MITARBEITER_ID = TGNummer AND LTRIM(STR(YEAR(dbo.honoris_journal.DATUM))) + LTRIM(STR(MONTH(dbo.honoris_journal.DATUM))) = JJMM
|
|
|
|
-- SELECT TGNummer, oenr, sortierung, START, Ende, Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, JJMM, PROJEKT_NR, SUM(Summe_Std) AS Summe_Std, ROUND(SUM(ROUND(Summe_Std / 8, 2)),2) AS Summe_Tage,
|
|
-- KURZNAME
|
|
-- INTO #tmpd
|
|
-- FROM #tmpc
|
|
-- GROUP BY TGNummer, oenr, sortierung, START, Ende, Vorhaben, Std, Engagement_Effektiv, Soll_Zeit, JJMM, PROJEKT_NR, KURZNAME
|
|
|
|
|
|
|
|
-- SELECT TOP ( 100 ) PERCENT
|
|
-- dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
-- a.sortierung AS Expr1, a.vorhaben, a.Std, a.Engagement_Effektiv, a.Soll_Zeit,a.JJMM, a.PROJEKT_NR AS Ticket_ID, a.Summe_Std,ROUND(a.Summe_Tage,2) AS Summe_Tage,a.KURZNAME AS kurzbeschreibung
|
|
-- INTO #tmpe
|
|
-- FROM #tmpd a
|
|
-- INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
-- INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
-- WHERE dbo.OE.oenr IN ( SELECT id
|
|
-- FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- AND dbo.oe.oenr NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
-- ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
--INSERT #tmpx
|
|
-- SELECT DISTINCT
|
|
-- #tmpe.TGNummer, #tmpe.oe, #tmpe.sortierung, #tmpe.START,
|
|
-- #tmpe.Ende, #tmpe.Vorhaben, #tmpe.Std, #tmpe.Engagement_Effektiv,
|
|
-- #tmpe.Soll_Zeit, #tmpe.JJMM, #tmpe.Ticket_ID, #tmpe.Summe_Std,
|
|
-- ROUND(#tmpe.Summe_Tage,2) AS Summe_Tage, #tmpe.Kurzbeschreibung, dbo.MA.TGNummer AS Expr1, dbo.MA.Name, dbo.MA.Vorname
|
|
|
|
-- FROM #tmpe INNER JOIN
|
|
|
|
-- dbo.MA ON #tmpe.TGNummer = dbo.MA.TGNummer
|
|
|
|
|
|
|
|
|
|
declare @jjmm varchar(255)
|
|
declare @tgnr varchar(255)
|
|
declare @tage float
|
|
declare xx cursor for
|
|
select jjmm, tgnummer from @tmpb
|
|
open xx
|
|
fetch next from xx into @jjmm, @tgnr
|
|
while @@FETCH_STATUS=0 BEGIN
|
|
SET @tage=0.00
|
|
select @tage=ISNULL(SUM(Summe_Tage),0.00) FROM #tmpx GROUP BY JJMM, TGNummer HAVING (TGNummer = @tgnr) and jjmm=@jjmm
|
|
IF @tage IS NULL SET @tage=0.00
|
|
update @tmpb set Std_Geleistet=@tage where tgnummer=@tgnr and jjmm=@jjmm
|
|
fetch next from xx into @jjmm, @tgnr
|
|
end
|
|
close xx
|
|
deallocate xx
|
|
declare @abwesenheit_anteil int
|
|
SET @abwesenheit_anteil = 15
|
|
select @abwesenheit_anteil=dbo.get_arbeitstage_prozent(@oestruktur)
|
|
|
|
UPDATE @tmpb SET abwesenheiten=@abwesenheit_anteil
|
|
|
|
--DROP table _an_04_summary
|
|
SELECT TOP ( 100 ) PERCENT
|
|
a.JJMM,dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, a.tgnummer, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.START, a.ende,
|
|
a.sortierung AS Sort, a.Pensum, ROUND(a.soll_zeit/100*a.pensum,2) AS Soll, a.std_geleistet AS Geleistet, a.Engagement_Effektiv,a.pensum-a.engagement_effektiv as Fuehrungsanteil, a.Soll_Zeit, a.abwesenheiten,
|
|
ROUND(100/ROUND(a.soll_zeit/100*a.pensum,2) * a.std_geleistet,2) AS CTB,
|
|
100-(ROUND(100/ROUND(a.soll_zeit/100*a.pensum,2) * a.std_geleistet,2))-(a.pensum-a.engagement_effektiv)-a.abwesenheiten AS RTB
|
|
--INTO _an_04_summary
|
|
FROM @tmpb a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN ( SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
--SELECT * FROM @tmpb ORDER BY tgnummer, start
|
|
--SELECT * FROM #tmpx
|
|
|
|
return
|
|
|
|
--DROP TABLE dbo._an_04
|
|
SELECT *
|
|
--INTO _an_04
|
|
FROM #tmpx
|
|
RETURN
|
|
|
|
drop table #tmpb
|
|
drop table #tmpfhr
|
|
drop table #tmpx
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikation_Datenbank] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_applikation_Datenbank]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
set @xsql='SELECT Bezeichnung, Datenbank, Titel from view_applikation_Datenbank'
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
end
|
|
exec(@xsql)
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikation_Intranet] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rpt_applikation_Intranet]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
set @xsql='SELECT Bezeichnung as Applikation, IntranetBezeichnung, VerwendungIntragnet as VerwendungIntranet, IntranetObligatorisch as IntranetObligatorisch FROM dbo.Applikation '
|
|
set @xsql=@xsql + ' where aktiv=1 and VerwendungIntragnet=1'
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' and ' + @sqlwhere + ' '
|
|
end
|
|
set @xsql=@xsql + ' order by Bezeichnung'
|
|
end
|
|
|
|
exec(@xsql)
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikation_server] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_applikation_server]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
set @xsql='SELECT Bezeichnung, Datenbank, Titel from view_applikation_Server '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
end
|
|
|
|
exec(@xsql)
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikation_sst] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rpt_applikation_sst]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
set @xsql='SELECT Bezeichnung, Datenbank, Titel from view_applikation_sst '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
end
|
|
|
|
exec(@xsql)
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikationsArchitektur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rpt_applikationsArchitektur]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
SELECT TOP (100) PERCENT dbo.Applikation.Bezeichnung
|
|
FROM dbo.Applikation INNER JOIN
|
|
dbo.ApplikationArchitektur ON dbo.Applikation.ApplikationNr = dbo.ApplikationArchitektur.Applikationnr
|
|
WHERE (dbo.Applikation.Aktiv = 1)
|
|
ORDER BY dbo.Applikation.Bezeichnung
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikationsArchitekturen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_applikationsArchitekturen]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
declare @xsql varchar(2048)
|
|
set @xsql = 'SELECT * from dbo.applview where bezeichnung <> ' + CHAR(39) + CHAR(39) + ' and aktiv=1 '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' and (' + @sqlwhere + ')'
|
|
end
|
|
set @xsql=@xsql+' ORDER BY bezeichnung'
|
|
exec(@xsql)
|
|
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikationsliste] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_applikationsliste]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
declare @xsql varchar(2048)
|
|
set @xsql = 'SELECT dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation.ParentID, dbo.Applikation.ApplikationVerantwortungNr, '
|
|
set @xsql = @xsql + ' dbo.Applikation.ApplikationKategorieNr, dbo.Applikation.Marktbereichnr, dbo.Applikation.Version, dbo.Applikation.AlsProdukt, dbo.Applikation.NurLizenz, '
|
|
set @xsql = @xsql + ' dbo.Applikation.PrioWiederanlauf, dbo.Applikation.Kurzbeschreibung, dbo.Applikation.Inaktivseit, dbo.Applikation.RAS, dbo.Applikation.Datenbankname, '
|
|
set @xsql = @xsql + ' dbo.Applikation.Anzahl_Installationen, dbo.Applikation.Test_Aufwand, dbo.Applikation.Test_Arbeitsplaetze, dbo.Applikation.Test_Abhaengigkeiten, '
|
|
set @xsql = @xsql + ' dbo.Applikation.Test_Bemerkung, dbo.Applikation.TicketXPertVerwendung, dbo.Applikation.TicketXPert_WPIAnzeigen, dbo.Applikation.TicketXPert_Preis, '
|
|
set @xsql = @xsql + ' dbo.Applikation.TicketXPert_Preis_Einmalig, dbo.Applikation.TicketXPert_AMAnzeigen, dbo.Applikation.TicketXPert_ApplikationKritikalitaetTypNr, '
|
|
set @xsql = @xsql + ' dbo.Applikation.TicketXPert_ApplikationSMLTypNr, dbo.Applikation.Erstellt_am, dbo.Applikation.Mutiert_am, dbo.Applikation.Mutierer, dbo.Applikation.SecurityLevelNr, '
|
|
set @xsql = @xsql + ' dbo.Applikation.RfcBoardNr, dbo.ApplikationKategorie.ApplikationKategorieNr AS Expr1, dbo.ApplikationKategorie.Bezeichnung AS Typ, '
|
|
set @xsql = @xsql + ' dbo.ApplikationVerantwortung.ApplikationVerantwortungNr AS Expr2, dbo.ApplikationVerantwortung.Bezeichnung AS Verantwortung'
|
|
set @xsql = @xsql + ' FROM dbo.Applikation INNER JOIN'
|
|
set @xsql = @xsql + ' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN'
|
|
set @xsql = @xsql + ' dbo.ApplikationVerantwortung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.ApplikationVerantwortung.ApplikationVerantwortungNr'
|
|
set @xsql = @xsql + ' WHERE (dbo.ApplikationKategorie.Aktiv = 1) AND (dbo.ApplikationVerantwortung.Aktiv = 1) AND (dbo.Applikation.Aktiv = 1)'
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' and (' + @sqlwhere + ')'
|
|
end
|
|
exec(@xsql)
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_Applikationsliste_Excel] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rpt_Applikationsliste_Excel]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
|
|
set @xsql='SELECT * from view_applikation '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' where ' + @sqlwhere
|
|
end
|
|
execute (@xsql)
|
|
end
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_Applikationsliste_Team] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_Applikationsliste_Team]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2024)
|
|
--set @xsql='SELECT DISTINCT'
|
|
--set @xsql=@xsql+' dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon,'
|
|
--set @xsql=@xsql+' LEN(dbo.Person.Telefon) - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr,'
|
|
--set @xsql=@xsql+' dbo.ApplikationKategorie.Bezeichnung AS Kategorie, dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung,'
|
|
--set @xsql=@xsql+' GremiumGruppierung_1.Gruppierungsbegriff AS Marktbereich, dbo.GremiumBereich.Bereich, GremiumBereich_1.Kurzbezeichnung AS RFCBoard'
|
|
--set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
--set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
--set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
--set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
--set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN'
|
|
--set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN'
|
|
--set @xsql=@xsql+' dbo.GremiumGruppierung GremiumGruppierung_1 ON dbo.Applikation.Marktbereichnr = GremiumGruppierung_1.GremiumGruppierungNr INNER JOIN'
|
|
--set @xsql=@xsql+' dbo.GremiumBereich GremiumBereich_1 ON dbo.Applikation.RfcBoardNr = GremiumBereich_1.GremiumBereichNr LEFT OUTER JOIN'
|
|
--set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr'
|
|
--set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
--set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumGruppierung.GremiumNr = 3) AND (GremiumGruppierung_1.GremiumNr = 4) AND'
|
|
--set @xsql=@xsql+' (dbo.GremiumBereich.GremiumGruppierungNr = 3) AND (GremiumBereich_1.GremiumGruppierungNr = 1)'
|
|
|
|
set @xsql='SELECT DISTINCT'
|
|
set @xsql=@xsql+' dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon,'
|
|
set @xsql=@xsql+' LEN(dbo.Person.Telefon) - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr,'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie.Bezeichnung AS Kategorie, dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung,'
|
|
set @xsql=@xsql+' dbo.GremiumBereich.Bereich, GremiumBereich_1.Kurzbezeichnung AS RFCBoard'
|
|
set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich GremiumBereich_1 ON dbo.Applikation.RfcBoardNr = GremiumBereich_1.GremiumBereichNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumGruppierung.GremiumNr = 3) AND '
|
|
set @xsql=@xsql+' (dbo.GremiumBereich.GremiumGruppierungNr = 3) AND (GremiumBereich_1.GremiumGruppierungNr = 1)'
|
|
|
|
set @xsql='SELECT DISTINCT '
|
|
set @xsql=@xsql+' dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, LEN(dbo.Person.Telefon) - 4, 5) AS telefon, '
|
|
set @xsql=@xsql+' dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie, '
|
|
set @xsql=@xsql+' dbo.GremiumBereich.Bereich AS Team, GremiumBereich_1.Kurzbezeichnung AS RFCBoard'
|
|
set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich AS GremiumBereich_1 ON dbo.Applikation.RfcBoardNr = GremiumBereich_1.GremiumBereichNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumBereich.GremiumGruppierungNr = 3) AND (GremiumBereich_1.GremiumGruppierungNr = 1)'
|
|
|
|
|
|
|
|
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' and (' + @sqlwhere + ')'
|
|
end
|
|
set @xsql=@xsql+' ORDER BY Applikation, dbo.Kontakttyp.KontakttypNr'
|
|
|
|
exec(@xsql)
|
|
|
|
end
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikationslisten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_applikationslisten]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
declare @xsql varchar(4096)
|
|
set @xsql='SELECT DISTINCT'
|
|
set @xsql=@xsql+' TOP (100) PERCENT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, LEN(dbo.Person.Telefon)'
|
|
set @xsql=@xsql+' - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie,'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung, GremiumGruppierung_1.Gruppierungsbegriff AS Marktbereich,'
|
|
set @xsql=@xsql+' dbo.GremiumBereich.Beschreibung AS RFCBoard'
|
|
set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung AS GremiumGruppierung_1 ON dbo.Applikation.Marktbereichnr = GremiumGruppierung_1.GremiumGruppierungNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.RfcBoardNr = dbo.GremiumBereich.GremiumBereichNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumGruppierung.GremiumNr = 3) AND (GremiumGruppierung_1.GremiumNr = 4) AND'
|
|
set @xsql=@xsql+' (dbo.GremiumBereich.GremiumGruppierungNr = 1)'
|
|
|
|
set @xsql='SELECT DISTINCT '
|
|
set @xsql=@xsql+' TOP (100) PERCENT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, LEN(dbo.Person.Telefon) '
|
|
set @xsql=@xsql+'- 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie, '
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung, dbo.GremiumBereich.Bereich AS Team, '
|
|
set @xsql=@xsql+' GremiumGruppierung_2.Gruppierungsbegriff AS Fachliche_Verantwortung, GremiumGruppierung_1.Gruppierungsbegriff AS Marktbereich, '
|
|
set @xsql=@xsql+' GremiumBereich_1.Beschreibung AS RFCBoard'
|
|
set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung AS GremiumGruppierung_1 ON dbo.Applikation.Marktbereichnr = GremiumGruppierung_1.GremiumGruppierungNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich AS GremiumBereich_1 ON dbo.Applikation.RfcBoardNr = GremiumBereich_1.GremiumBereichNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung AS GremiumGruppierung_2 ON dbo.Applikation.FachlicheOe = GremiumGruppierung_2.GremiumGruppierungNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (GremiumGruppierung_1.GremiumNr = 4) AND (GremiumBereich_1.GremiumGruppierungNr = 1) AND '
|
|
set @xsql=@xsql+' (dbo.GremiumGruppierung.GremiumNr = 3)'
|
|
|
|
|
|
set @xsql='SELECT DISTINCT '
|
|
set @xsql=@xsql+' TOP (100) PERCENT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, '
|
|
set @xsql=@xsql+' LEN(dbo.Person.Telefon) - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, '
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie.Bezeichnung AS Kategorie, dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung, dbo.GremiumBereich.Bereich AS Team, '
|
|
set @xsql=@xsql+' GremiumGruppierung_2.Gruppierungsbegriff AS Fachliche_Verantwortung, GremiumBereich_1.Beschreibung AS RFCBoard'
|
|
set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich AS GremiumBereich_1 ON dbo.Applikation.RfcBoardNr = GremiumBereich_1.GremiumBereichNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung AS GremiumGruppierung_2 ON dbo.Applikation.FachlicheOe = GremiumGruppierung_2.GremiumGruppierungNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (GremiumBereich_1.GremiumGruppierungNr = 1) AND (dbo.GremiumGruppierung.GremiumNr = 3)'
|
|
|
|
|
|
set @xsql='SELECT DISTINCT'
|
|
set @xsql=@xsql+' TOP (100) PERCENT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, '
|
|
set @xsql=@xsql+' LEN(dbo.Person.Telefon) - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, '
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie.Bezeichnung AS Kategorie, dbo.get_gremium(dbo.GremiumGruppierung.GremiumGruppierungNr) AS IT_Aufgaben_erbringt, '
|
|
set @xsql=@xsql+' dbo.GremiumBereich.Bereich AS Team, dbo.get_gremium(GremiumGruppierung_2.GremiumGruppierungNr) AS KeyUser_Aufgaben_erbringt, '
|
|
set @xsql=@xsql+' GremiumBereich_1.Beschreibung AS RFCBoard'
|
|
set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung AS GremiumGruppierung_2 ON dbo.Applikation.FachlicheOe = GremiumGruppierung_2.GremiumGruppierungNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich AS GremiumBereich_1 ON dbo.Applikation.RfcBoardNr = GremiumBereich_1.GremiumBereichNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (GremiumBereich_1.GremiumGruppierungNr = 1 or GremiumBereich_1.GremiumGruppierungNr = 77) AND (dbo.GremiumGruppierung.GremiumNr = 3)'
|
|
|
|
|
|
--set @xsql = 'SELECT DISTINCT '
|
|
-- set @xsql=@xsql+' TOP (100) PERCENT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, LEN(dbo.Person.Telefon) '
|
|
-- set @xsql=@xsql+' - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie, '
|
|
-- set @xsql=@xsql+' isnull(dbo.get_gremium(dbo.GremiumGruppierung.GremiumGruppierungNr),'') AS IT_Aufgaben_erbringt, dbo.GremiumBereich.Bereich AS Team, '
|
|
-- set @xsql=@xsql+' isnull(dbo.get_gremium(GremiumGruppierung_2.GremiumGruppierungNr),'') AS KeyUser_Aufgaben_erbringt, GremiumBereich_1.Beschreibung AS RFCBoard '
|
|
--set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN '
|
|
-- set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN '
|
|
-- set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr RIGHT OUTER JOIN '
|
|
-- set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr LEFT OUTER JOIN '
|
|
-- set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr LEFT OUTER JOIN '
|
|
-- set @xsql=@xsql+' dbo.GremiumGruppierung AS GremiumGruppierung_2 ON dbo.Applikation.FachlicheOe = GremiumGruppierung_2.GremiumGruppierungNr LEFT OUTER JOIN '
|
|
-- set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr LEFT OUTER JOIN '
|
|
-- set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr LEFT OUTER JOIN '
|
|
-- set @xsql=@xsql+' dbo.GremiumBereich AS GremiumBereich_1 ON dbo.Applikation.RfcBoardNr = GremiumBereich_1.GremiumBereichNr '
|
|
--set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) '
|
|
|
|
set @xsql = 'SELECT DISTINCT [Applikation],[Name],[Vorname],[telefon],[EMail],[Kontakttyp],[KontakttypNr],[Kategorie],[IT_Aufgaben_erbringt],[Team],[KeyUser_Aufgaben_erbringt] '
|
|
set @xsql=@xsql+' ,[RFCBoard] from view_applikationslisten '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' where (' + @sqlwhere + ')'
|
|
end
|
|
set @xsql=@xsql+' ORDER BY Applikation, KontakttypNr'
|
|
print @xsql
|
|
|
|
exec(@xsql)
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_applikationslisten_sik] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
create PROCEDURE [dbo].[sp_rpt_applikationslisten_sik]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON;
|
|
declare @xsql varchar(4096)
|
|
set @xsql='SELECT DISTINCT'
|
|
set @xsql=@xsql+' dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, LEN(dbo.Person.Telefon)'
|
|
set @xsql=@xsql+' - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie,'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung, GremiumGruppierung_1.Gruppierungsbegriff AS Marktbereich,'
|
|
set @xsql=@xsql+' dbo.GremiumBereich.Kurzbezeichnung AS RFCBoard'
|
|
set @xsql=@xsql+' FROM dbo.ApplikationKontakt INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung AS GremiumGruppierung_1 ON dbo.Applikation.Marktbereichnr = GremiumGruppierung_1.GremiumGruppierungNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumBereich ON dbo.Applikation.RfcBoardNr = dbo.GremiumBereich.GremiumBereichNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR'
|
|
set @xsql=@xsql+' dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumGruppierung.GremiumNr = 3) AND (GremiumGruppierung_1.GremiumNr = 4) AND'
|
|
set @xsql=@xsql+' (dbo.GremiumBereich.GremiumGruppierungNr = 1)'
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' and (' + @sqlwhere + ')'
|
|
end
|
|
set @xsql=@xsql+' ORDER BY Applikation, dbo.Kontakttyp.KontakttypNr'
|
|
|
|
exec(@xsql)
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_avaloq_gremien] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_avaloq_gremien]
|
|
|
|
@sqlwhere varchar(1024)
|
|
|
|
AS
|
|
BEGIN
|
|
|
|
declare @xsql varchar(2048)
|
|
set @xsql='SELECT dbo.GremiumGruppierung.Gruppierungsbegriff AS [Group], dbo.GremiumBereich.Bereich AS Gremium, dbo.GremiumBereich.Beschreibung,'
|
|
set @xsql=@xsql+' dbo.Person.Name, dbo.Person.Vorname,dbo.Kontakttyp.Bezeichnung AS Rollle, dbo.GremiumPerson.Leitung,'
|
|
set @xsql=@xsql+' dbo.GremiumPerson.Beschreibung AS PersonBeschreibung, dbo.Vertragspartner.NameZ1 + ' + char(39) + ' ' + char(39) +' + dbo.Vertragspartner.NameZ2 AS Firma'
|
|
set @xsql=@xsql+' FROM dbo.GremiumBereich INNER JOIN'
|
|
set @xsql=@xsql+' dbo.GremiumPerson ON dbo.GremiumBereich.GremiumBereichNr = dbo.GremiumPerson.GremiumBereichNr INNER JOIN'
|
|
|
|
set @xsql=@xsql+' dbo.Person ON dbo.GremiumPerson.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
|
|
set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.GremiumBereich.GremiumGruppierungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN'
|
|
|
|
set @xsql=@xsql+' dbo.Gremium ON dbo.GremiumGruppierung.GremiumNr = dbo.Gremium.GremiumNr INNER JOIN'
|
|
|
|
set @xsql=@xsql+' dbo.Vertragspartner ON dbo.Person.Vertragspartnernr = dbo.Vertragspartner.VertragspartnerNr LEFT OUTER JOIN'
|
|
|
|
set @xsql=@xsql+' dbo.Kontakttyp ON dbo.GremiumPerson.RolleNr = dbo.Kontakttyp.KontakttypNr'
|
|
|
|
set @xsql=@xsql+' WHERE (dbo.GremiumBereich.Aktiv = 1) AND (dbo.GremiumPerson.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.Gremium.GremiumNr = 5) and (dbo.gremiumgruppierung.aktiv=1)'
|
|
if @sqlwhere <> '' begin
|
|
|
|
set @xsql=@xsql+' and (' + @sqlwhere + ') '
|
|
|
|
end
|
|
|
|
set @xsql = @xsql + ' ORDER BY dbo.gremiumbereich.bereich, dbo.gremiumperson.leitung desc, dbo.person.name '
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
print @xsql
|
|
|
|
exec(@xsql)
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_check_Kern_Workplace_appl] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_check_Kern_Workplace_appl]
|
|
@sqlwhere varchar(1024)
|
|
as
|
|
SELECT dbo.ApplikationKategorie.Bezeichnung AS Kategorie, dbo.Applikation.Bezeichnung AS Applikation,
|
|
dbo.GremiumGruppierung.Gruppierungsbegriff AS [Aktuelle Verantwortung]
|
|
FROM dbo.Applikation INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr
|
|
Where (dbo.Applikation.ApplikationVerantwortungNr <> 3) AND dbo.applikation.aktiv=1 and (dbo.ApplikationKategorie.ApplikationKategorieNr = 1 OR
|
|
dbo.ApplikationKategorie.ApplikationKategorieNr = 4)
|
|
|
|
ORDER BY Kategorie, Applikation
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_Anzahl] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_Anzahl]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL,
|
|
@OEStruktur INT = NULL,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.03.2013'
|
|
IF @bis IS NULL
|
|
SET @bis = '26.07.2013'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur=24
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
--DECLARE @per DATETIME = NULL ,
|
|
-- @von DATETIME = NULL ,
|
|
-- @bis DATETIME = NULL
|
|
--SET @per = '01.03.2013'
|
|
--SET @von = '01.03.2013'
|
|
--SET @bis = '31.03.2013'
|
|
DECLARE @save_von DATETIME
|
|
DECLARE @save_bis datetime
|
|
|
|
SET @save_von=@von
|
|
SET @save_bis=@bis
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
[AU_offen] [INT] NOT NULL ,
|
|
[AU_Geschlossen] [INT] NOT NULL ,
|
|
[IN_Offen] [INT] NOT NULL ,
|
|
[IN_Geschlossen] [INT] NOT NULL ,
|
|
[IN_Langlaeufer] [INT] NOT NULL ,
|
|
[IN_Aufwand] [float] NOT NULL ,
|
|
[IN_GT_1PT] INT NOT NULL
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.5
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, 0, 0, 0, 0, 0, 0.00, 0
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
AND madetails.oenr IN (SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur))
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
-- Geschlossene AU
|
|
DECLARE @anzahl INT
|
|
DECLARE @aufwand FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketId) AS Expr1
|
|
FROM dbo.TXP_AU_Geschlossen
|
|
WHERE Status_Changedate BETWEEN @von AND @bis
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
UPDATE @tmpa
|
|
SET AU_Geschlossen = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
---- Offene AU
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketID) AS Expr1
|
|
FROM dbo.TXP_AU_Offen
|
|
WHERE status_changedate BETWEEN @von AND @bis
|
|
AND ticketid NOT IN ( SELECT ticketid
|
|
FROM dbo.TXP_AU_Geschlossen
|
|
WHERE Status_Changedate BETWEEN @von AND @bis )
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET AU_offen = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
---- Geschlossene IN
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketId) AS Expr1
|
|
FROM dbo.TXP_IN_Geschlossen
|
|
WHERE Status_Changedate BETWEEN @von AND @bis
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_Geschlossen = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
|
|
-- Offene IN Langläufer
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketID) AS Expr1
|
|
FROM dbo.TXP_IN_Offene_Langlaeufer
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_Langlaeufer = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
-- Geschlossene IN Aufwand
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(Ticket_ID)
|
|
FROM dbo.TXP_IN_Geschlossen_IN_Aufwand
|
|
WHERE status_changedate BETWEEN @von AND @bis AND aufwand > @ansatz
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_gt_1pt = IN_GT_1PT + @aufwand
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
-- Geschlossene IN Aufwand
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, SUM(Aufwand)
|
|
FROM dbo.TXP_IN_Geschlossen_Aufwand
|
|
WHERE status_changedate BETWEEN @von AND @bis
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_Aufwand = in_aufwand + @aufwand
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
|
|
---- Offene IN
|
|
-- DECLARE xc CURSOR
|
|
-- FOR
|
|
-- SELECT TGNummer, COUNT(TicketID) AS Expr1
|
|
-- FROM dbo.TXP_IN_Offen
|
|
-- WHERE status_changedate BETWEEN @save_von AND @save_bis
|
|
-- AND ticketid NOT IN ( SELECT ticketid
|
|
-- FROM dbo.TXP_IN_Geschlossen
|
|
-- WHERE Status_Changedate BETWEEN @save_von AND @save_bis )
|
|
-- GROUP BY TGNummer
|
|
-- OPEN xc
|
|
-- FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
-- WHILE @@FETCH_STATUS = 0
|
|
-- BEGIN
|
|
-- UPDATE @tmpa
|
|
-- SET IN_offen = @anzahl
|
|
-- WHERE tgnummer = @ma
|
|
-- AND start = @save_von
|
|
-- FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
-- END
|
|
-- CLOSE xc
|
|
-- DEALLOCATE xc
|
|
|
|
|
|
|
|
UPDATE @tmpa SET in_aufwand = in_aufwand / @ansatz
|
|
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
a.sortierung AS Expr1, a.AU_offen, a.AU_Geschlossen, a.IN_Offen, a.IN_Geschlossen, a.IN_Aufwand, a.IN_GT_1PT, a.in_Langlaeufer
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN (SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur))
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
SELECT OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1 AS Sort, SUM(au_offen) AS au_offen, SUM(AU_Geschlossen) AS au_geschlossen,
|
|
SUM(IN_Offen) AS in_offen, SUM(in_geschlossen) AS in_geschlossen, SUM(in_Aufwand) AS in_Aufwand, SUM(IN_GT_1PT) AS in_get_1pt,
|
|
SUM(IN_Langlaeufer) AS IN_Langlaeufer
|
|
INTO #tmpfhr1
|
|
FROM #tmpfhr
|
|
GROUP BY OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1
|
|
|
|
|
|
SELECT *
|
|
FROM #tmpfhr1
|
|
ORDER BY OESort, Sortierung, Name
|
|
|
|
DROP TABLE #tmpfhr
|
|
DROP TABLE #tmpfhr1
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_Anzahl_neu] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_Anzahl_neu]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL,
|
|
@OEStruktur INT = NULL,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL,
|
|
@Mitarbeiter_Ausschluss varchar(255)=null
|
|
AS
|
|
BEGIN
|
|
|
|
|
|
IF @von IS NULL SET @von = convert(datetime,'01.01.2014',104) else set @von=CONVERT(datetime,@von,104)
|
|
IF @bis IS NULL SET @bis = convert(datetime,'31.05.2014',104) else set @bis=CONVERT(datetime,@bis,104)
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur=24
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
if @mitarbeiter_ausschluss is null set @Mitarbeiter_Ausschluss=''
|
|
DECLARE @save_von DATETIME
|
|
DECLARE @save_bis datetime
|
|
|
|
declare @dd1 varchar(2)
|
|
declare @mm1 varchar(2)
|
|
declare @yy1 varchar(4)
|
|
declare @datum varchar(255)
|
|
set @dd1=DAY(@von)
|
|
set @mm1=MONTH(@von)
|
|
set @yy1=YEAR(@von)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 00:00:00'
|
|
set @von=convert(datetime,@datum,20)
|
|
|
|
set @dd1=DAY(@bis)
|
|
set @mm1=MONTH(@bis)
|
|
set @yy1=YEAR(@bis)
|
|
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 23:59:59'
|
|
|
|
set @bis=convert(datetime,@datum,20)
|
|
|
|
SET @save_von=@von
|
|
SET @save_bis=@bis
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
[AU_offen] [INT] NOT NULL ,
|
|
[AU_Geschlossen] [INT] NOT NULL ,
|
|
[IN_Offen] [INT] NOT NULL ,
|
|
[IN_Geschlossen] [INT] NOT NULL ,
|
|
[IN_Langlaeufer] [INT] NOT NULL ,
|
|
[IN_Aufwand] [float] NOT NULL ,
|
|
[IN_GT_1PT] INT NOT NULL
|
|
)
|
|
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
--print @bis
|
|
--print @von
|
|
--SELECT manr
|
|
-- FROM ma
|
|
-- WHERE aktiv = 1
|
|
-- AND gueltig_bis >= @bis
|
|
--return
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT @von AS von, @bis AS bis
|
|
--select start_date, end_date
|
|
-- FROM dbo.get_monatstabelle(@von, @bis)
|
|
-- ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
--print @von
|
|
--print @bis
|
|
print 'Loop 1'
|
|
print convert(varchar(24), getdate(),121)
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE (aktiv = 1
|
|
AND gueltig_bis >= @bis or manr in (select manr from madetails where aktiv=1 and gueltig_ab >=@von)) and
|
|
manr not in (select item from dbo.fnkt_split(@mitarbeiter_ausschluss,',',1))
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND (Gueltig_ab <= @von or Gueltig_ab <=@bis)
|
|
if @mnr = 71 print @rc
|
|
IF @rc > 0
|
|
BEGIN
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, 0, 0, 0, 0, 0, 0.00, 0
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND (Gueltig_ab <= @von or Gueltig_ab <=@bis)
|
|
AND madetails.oenr IN (SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur))
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
-- Geschlossene AU
|
|
print 'Loop 2'
|
|
print convert(varchar(24), getdate(),121)
|
|
DECLARE @anzahl INT
|
|
DECLARE @aufwand FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketId) AS Expr1
|
|
FROM dbo.TXP_AU_Geschlossen
|
|
WHERE Status_Changedate BETWEEN @von AND @bis
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
UPDATE @tmpa
|
|
SET AU_Geschlossen = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
---- Offene AU
|
|
print 'Loop 3'
|
|
print convert(varchar(24), getdate(),121)
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketID) AS Expr1
|
|
FROM dbo.TXP_AU_Offen
|
|
WHERE status_changedate < @bis
|
|
AND ticketid NOT IN ( SELECT ticketid
|
|
FROM dbo.TXP_AU_Geschlossen
|
|
WHERE Status_Changedate BETWEEN @von AND @bis )
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET AU_offen = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
-- Geschlossene IN
|
|
print 'Loop 4'
|
|
print convert(varchar(24), getdate(),121)
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketId) AS Expr1
|
|
FROM dbo.TXP_IN_Geschlossen
|
|
WHERE convert(datetime,Status_Changedate,20) BETWEEN @von AND @bis
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_Geschlossen = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
print 'Loop 5'
|
|
print convert(varchar(24), getdate(),121)
|
|
|
|
-- Offene IN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketID) AS Expr1
|
|
FROM dbo.TXP_IN_Offen
|
|
WHERE status_changedate < @save_bis and status_changedate > @save_von -- 2014-06-01
|
|
AND ticketid NOT IN ( SELECT ticketid
|
|
FROM dbo.TXP_IN_Geschlossen
|
|
WHERE Status_Changedate BETWEEN @save_von AND @save_bis )
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
UPDATE @tmpa
|
|
SET IN_offen = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @save_von
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
|
|
--Offene IN Langläufer
|
|
print 'Loop 6'
|
|
print convert(varchar(24), getdate(),121)
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(TicketID) AS Expr1
|
|
FROM dbo.TXP_IN_Offene_Langlaeufer
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_Langlaeufer = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @anzahl
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
--Geschlossene IN Aufwand
|
|
print 'Loop 7'
|
|
print convert(varchar(24), getdate(),121)
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, COUNT(Ticket_ID)
|
|
FROM dbo.TXP_IN_Geschlossen_IN_Aufwand
|
|
WHERE status_changedate < @bis AND aufwand > @ansatz
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_gt_1pt = IN_GT_1PT + @aufwand
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
-- Geschlossene IN Aufwand
|
|
print 'Loop 8'
|
|
print @von
|
|
print @bis
|
|
print convert(varchar(24), getdate(),121)
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT TGNummer, SUM(Aufwand)
|
|
FROM dbo.TXP_IN_Geschlossen_Aufwand
|
|
WHERE status_changedate < @bis and status_changedate > @von -- Von-Datum berücksichtigen 2014-05-06
|
|
GROUP BY TGNummer
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET IN_Aufwand = in_aufwand + @aufwand
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @ma, @aufwand
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
|
|
|
|
print 'Loop 9'
|
|
print convert(varchar(24), getdate(),121)
|
|
|
|
UPDATE @tmpa SET in_aufwand = in_aufwand
|
|
--/ @ansatz
|
|
-- 2014-06-01 - Distinct einbauen
|
|
SELECT DISTINCT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
a.sortierung AS Expr1, a.AU_offen, a.AU_Geschlossen, a.IN_Offen, a.IN_Geschlossen, a.IN_Aufwand, a.IN_GT_1PT, a.in_Langlaeufer
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN (SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur))
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
print 'Loop 10'
|
|
print convert(varchar(24), getdate(),121)
|
|
SELECT OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1 AS Sort, SUM(au_offen) AS au_offen, SUM(AU_Geschlossen) AS au_geschlossen,
|
|
SUM(IN_Offen) AS in_offen, SUM(in_geschlossen) AS in_geschlossen, SUM(in_Aufwand) AS in_Aufwand, SUM(IN_GT_1PT) AS in_get_1pt,
|
|
SUM(IN_Langlaeufer) AS IN_Langlaeufer
|
|
INTO #tmpfhr1
|
|
FROM #tmpfhr
|
|
GROUP BY OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1
|
|
|
|
print 'Loop 11'
|
|
print convert(varchar(24), getdate(),121)
|
|
SELECT *
|
|
FROM #tmpfhr1
|
|
ORDER BY OESort, Sortierung, Name
|
|
|
|
DROP TABLE #tmpfhr
|
|
DROP TABLE #tmpfhr1
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_Anzahl_neu_checkliste] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_Anzahl_neu_checkliste] @von DATETIME = NULL
|
|
,@bis DATETIME = NULL
|
|
,@OEStruktur INT = NULL
|
|
,@struktur_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = convert(DATETIME, '01.01.2014', 104)
|
|
ELSE
|
|
SET @von = CONVERT(DATETIME, @von, 104)
|
|
|
|
IF @bis IS NULL
|
|
SET @bis = convert(DATETIME, '31.05.2014', 104)
|
|
ELSE
|
|
SET @bis = CONVERT(DATETIME, @bis, 104)
|
|
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 24
|
|
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = '31'
|
|
|
|
DECLARE @save_von DATETIME
|
|
DECLARE @save_bis DATETIME
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = convert(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = convert(DATETIME, @datum, 20)
|
|
SET @save_von = @von
|
|
SET @save_bis = @bis
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE (
|
|
[TGNummer] [varchar](50) NULL
|
|
,oenr INT
|
|
,sortierung INT
|
|
,START DATETIME
|
|
,Ende DATETIME
|
|
,[AU_offen] [INT] NOT NULL
|
|
,[AU_Geschlossen] [INT] NOT NULL
|
|
,[IN_Offen] [INT] NOT NULL
|
|
,[IN_Geschlossen] [INT] NOT NULL
|
|
,[IN_Langlaeufer] [INT] NOT NULL
|
|
,[IN_Aufwand] [float] NOT NULL
|
|
,[IN_GT_1PT] INT NOT NULL
|
|
)
|
|
DECLARE @tickettable TABLE (
|
|
tgnummer VARCHAR(255)
|
|
,NAME VARCHAR(255)
|
|
,ticketid VARCHAR(255)
|
|
,statusdatum VARCHAR(255)
|
|
,STATUS VARCHAR(255)
|
|
)
|
|
DECLARE @ansatz FLOAT
|
|
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT @von AS von
|
|
,@bis AS bis
|
|
|
|
OPEN xm
|
|
|
|
FETCH NEXT
|
|
FROM xm
|
|
INTO @von
|
|
,@bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OR manr IN (
|
|
SELECT manr
|
|
FROM dbo.MADetails
|
|
WHERE Gueltig_ab >= @von
|
|
)
|
|
|
|
OPEN xc
|
|
|
|
FETCH NEXT
|
|
FROM xc
|
|
INTO @mnr
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab >= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
INSERT @tmpa
|
|
SELECT TOP 1 dbo.MA.TGNummer
|
|
,madetails.OENr
|
|
,ma.sortierung
|
|
,@von
|
|
,@bis
|
|
,0
|
|
,0
|
|
,0
|
|
,0
|
|
,0
|
|
,0.00
|
|
,0
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab >= @von
|
|
AND madetails.oenr IN (
|
|
SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur)
|
|
)
|
|
ORDER BY Gueltig_ab DESC
|
|
END
|
|
|
|
FETCH NEXT
|
|
FROM xc
|
|
INTO @mnr
|
|
END
|
|
|
|
CLOSE xc
|
|
|
|
DEALLOCATE xc
|
|
|
|
DELETE FROM @tmpa WHERE oenr IN ( SELECT item FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr NOT IN ( SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- select * from @tmpa
|
|
-- return
|
|
-- Geschlossene AU
|
|
DECLARE @anzahl INT
|
|
DECLARE @aufwand FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
DECLARE @ticketid VARCHAR(255)
|
|
DECLARE @tgnummer VARCHAR(255)
|
|
DECLARE @statusdatum VARCHAR(255)
|
|
|
|
INSERT @tickettable (
|
|
tgnummer
|
|
,NAME
|
|
,ticketid
|
|
,statusdatum
|
|
,STATUS
|
|
)
|
|
SELECT tgnummer
|
|
,''
|
|
,ticketid
|
|
,status_changedate
|
|
,'Geschlossen'
|
|
FROM dbo.txp_au_geschlossen
|
|
WHERE Status_Changedate BETWEEN @von
|
|
AND @bis
|
|
AND tgnummer IN (
|
|
SELECT tgnummer
|
|
FROM @tmpa
|
|
)
|
|
|
|
INSERT @tickettable (
|
|
tgnummer
|
|
,NAME
|
|
,ticketid
|
|
,statusdatum
|
|
,STATUS
|
|
)
|
|
SELECT tgnummer
|
|
,''
|
|
,ticketid
|
|
,status_changedate
|
|
,'Offen'
|
|
FROM dbo.txp_au_offen
|
|
WHERE Status_Changedate <= @bis
|
|
AND tgnummer IN (
|
|
SELECT tgnummer
|
|
FROM @tmpa
|
|
)
|
|
|
|
INSERT @tickettable (
|
|
tgnummer
|
|
,NAME
|
|
,ticketid
|
|
,statusdatum
|
|
,STATUS
|
|
)
|
|
SELECT tgnummer
|
|
,''
|
|
,ticketid
|
|
,status_changedate
|
|
,'Offen'
|
|
FROM dbo.txp_in_offen
|
|
WHERE Status_Changedate <=@bis
|
|
AND tgnummer IN (
|
|
SELECT tgnummer
|
|
FROM @tmpa
|
|
)
|
|
|
|
INSERT @tickettable (
|
|
tgnummer
|
|
,NAME
|
|
,ticketid
|
|
,statusdatum
|
|
,STATUS
|
|
)
|
|
SELECT tgnummer
|
|
,''
|
|
,ticketid
|
|
,status_changedate
|
|
,'Geschlossen'
|
|
FROM dbo.txp_in_geschlossen
|
|
WHERE Status_Changedate BETWEEN @von
|
|
AND @bis
|
|
AND tgnummer IN (
|
|
SELECT tgnummer
|
|
FROM @tmpa
|
|
)
|
|
|
|
FETCH NEXT
|
|
FROM xm
|
|
INTO @von
|
|
,@bis
|
|
END
|
|
|
|
CLOSE xm
|
|
|
|
DEALLOCATE xm
|
|
|
|
UPDATE @tickettable
|
|
SET a.[NAME] = ma.[NAME]
|
|
FROM @tickettable a
|
|
INNER JOIN ma ON ma.TGNummer = a.tgnummer
|
|
|
|
SELECT *
|
|
FROM @tickettable
|
|
ORDER BY tgnummer
|
|
,ticketid
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_aufwand] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_aufwand]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL,
|
|
@Mitarbeiter_Ausschluss varchar(255)=null,
|
|
@layout varchar(20)=null
|
|
AS
|
|
BEGIN
|
|
if @layout='WPI' begin
|
|
exec dbo.sp_rpt_fhrlst_aufwand_WPI
|
|
@von,
|
|
@bis,
|
|
@oestruktur,
|
|
@struktur_Ausschluss,
|
|
@Honoris_Ausschluss
|
|
return
|
|
end
|
|
IF @von IS NULL
|
|
SET @von = '2015-01-01 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '2015-06-30 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 24
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
if @Mitarbeiter_Ausschluss is null set @Mitarbeiter_Ausschluss=''
|
|
|
|
declare @dd1 varchar(2)
|
|
declare @mm1 varchar(2)
|
|
declare @yy1 varchar(4)
|
|
declare @datum varchar(255)
|
|
set @dd1=DAY(@von)
|
|
set @mm1=MONTH(@von)
|
|
set @yy1=YEAR(@von)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 00:00:00'
|
|
set @von=convert(datetime,@datum,20)
|
|
set @dd1=DAY(@bis)
|
|
set @mm1=MONTH(@bis)
|
|
set @yy1=YEAR(@bis)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 23:59:59'
|
|
set @bis=convert(datetime,@datum,20)
|
|
print @von
|
|
print @bis
|
|
|
|
--'' SET @oestruktur=34
|
|
--'' SET @von = '01.02.2013 00:00:01'
|
|
--'' SET @bis = '28.02.2013 23:59:50'
|
|
|
|
|
|
--DECLARE @per DATETIME = NULL ,
|
|
-- @von DATETIME = NULL ,
|
|
-- @bis DATETIME = NULL
|
|
--SET @per = '01.03.2013'
|
|
--SET @von = '01.03.2013'
|
|
--SET @bis = '31.03.2013'
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
[Paufwand] [float] NOT NULL ,
|
|
[RFC_300] [float] NOT NULL ,
|
|
[CTB] [float] NOT NULL ,
|
|
[RTB] [float] NOT NULL ,
|
|
RFC_200 FLOAT NOT NULL ,
|
|
[Total] [float] NOT NULL ,
|
|
[Soll] [float] NOT NULL ,
|
|
[Prod] [float] NOT NULL ,
|
|
[Anteil_CTB] [float] NOT NULL ,
|
|
[Anteil_RTB] [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Soll_Zeit FLOAT NOT NULL
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis and
|
|
manr not in (select item from dbo.fnkt_split(@mitarbeiter_ausschluss,',',1))
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
|
|
BEGIN
|
|
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
print @mnr
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
|
|
0.00, 0.00, 0.00, dbo.get_anteil(engagement, MitarbeiterTypNr),
|
|
dbo.get_arbeitstage(madetails.MADetailNr, year(@von),month(@von)) --dbo.get_arbeitstage(year(@von),month(@von))
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE @anzahl FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
-- Honris 200
|
|
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmphono
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE (dbo.honoris_projekt.BOOL2=1
|
|
--( dbo.Honoris_PROJEKT.PROJEKT_NR >= 200 )
|
|
--AND ( dbo.Honoris_PROJEKT.PROJEKT_NR < 300 )
|
|
)
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmphono
|
|
WHERE ( DATUM >= @von
|
|
AND DATUM <= @bis
|
|
)
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rfc_200 = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
DROP TABLE #tmpHono
|
|
-- Honris 300
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmphono1
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
where dbo.honoris_PROJEKT.BOOL4=1 --and dbo.honoris_projekt.bool4=0
|
|
and dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
|
|
--WHERE (dbo.honoris_PROJEKT.BOOL3=1 and ( dbo.Honoris_PROJEKT.PROJEKT_NR >= 300 )
|
|
-- AND ( dbo.Honoris_PROJEKT.PROJEKT_NR <= 399 ))
|
|
-- AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmphono1
|
|
WHERE ( DATUM >= @von
|
|
AND DATUM <= @bis
|
|
)
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rfc_300 = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
DROP TABLE #tmphono1
|
|
|
|
|
|
-- Honoris <> 300
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmpHono2
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE dbo.honoris_projekt.BOOL3=1 and dbo.honoris_projekt.bool4=0
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
|
|
--WHERE (dbo.honoris_projekt.BOOL3=1 and ( dbo.Honoris_PROJEKT.PROJEKT_NR < 300 )
|
|
-- OR ( dbo.Honoris_PROJEKT.PROJEKT_NR > 399 ))
|
|
-- AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmpHono2
|
|
WHERE ( DATUM >= @von )
|
|
AND ( DATUM <= @bis )
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET Paufwand = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
DROP TABLE #tmpHono2
|
|
-- IN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(CalculatedValue) AS Expr1, ForUserID
|
|
FROM dbo.TXP_LVer_IN_AU
|
|
WHERE ( ExecutedDateTime >= @von
|
|
AND ExecutedDateTime <= @bis
|
|
)
|
|
AND ( Ticket_ID LIKE N'IN_%' )
|
|
GROUP BY ForUserID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rtb = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
-- AU
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(CalculatedValue) AS Expr1, ForUserID
|
|
FROM dbo.TXP_LVer_IN_AU
|
|
WHERE ( ExecutedDateTime >= @von
|
|
AND ExecutedDateTime <= @bis
|
|
)
|
|
AND ( Ticket_ID LIKE N'AU_%' )
|
|
GROUP BY ForUserID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET ctb = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
|
|
--select * from @tmpa where TGNummer='TG8166'
|
|
|
|
UPDATE @tmpa
|
|
SET total = paufwand + rfc_300 + ctb + rtb + rfc_200
|
|
|
|
|
|
|
|
-- Berechnen
|
|
UPDATE @tmpa
|
|
SET soll = ( soll_zeit * @ansatz ) / 100 * Engagement_Effektiv
|
|
|
|
SELECT Distinct TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
a.sortierung AS Expr1, a.Paufwand, a.RFC_300, a.CTB, a.RTB, a.RFC_200, a.Total, a.Soll, a.Prod, a.Anteil_CTB, a.Anteil_RTB,
|
|
a.Engagement_Effektiv, a.Soll_Zeit
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN ( SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) ) and ma.Aktiv=1
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
--select * from #tmpfhr where TGNummer='tg8166'
|
|
SELECT OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1 AS Sort, Engagement_Effektiv, SUM(Paufwand) AS PAufwand, SUM(RFC_300) AS RFC_300,
|
|
SUM(CTB) AS CTB, SUM(RTB) AS RTB, SUM(RFC_200) AS RFC_200, SUM(Total) AS Total, SUM(Soll) AS Soll, CONVERT(NUMERIC(18, 2), 0.00) AS Prod,
|
|
CONVERT(NUMERIC(18, 2), 0.00) AS Anteil_CTB, CONVERT(NUMERIC(18, 2), 0.00) AS Anteil_Rtb
|
|
INTO #tmpfhr1
|
|
FROM #tmpfhr
|
|
GROUP BY OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1, Engagement_Effektiv
|
|
|
|
UPDATE #tmpfhr1
|
|
SET prod = ROUND(total / soll * 100, 2)
|
|
WHERE total > 0
|
|
AND soll > 0
|
|
UPDATE #tmpfhr1
|
|
SET Anteil_CTB = ROUND(( ( paufwand + rfc_300 + ctb ) / Total ) * 100, 2)
|
|
WHERE total > 0
|
|
AND ( paufwand + rfc_300 + ctb ) > 0
|
|
UPDATE #tmpfhr1
|
|
SET Anteil_rtb = ROUND(( ( rfc_200 + rtb ) / total ) * 100, 2)
|
|
WHERE total > 0
|
|
AND ( rfc_200 + rtb ) > 0
|
|
|
|
if @layout='intern' begin
|
|
SELECT *
|
|
FROM #tmpfhr1
|
|
ORDER BY OESort, Sortierung, Name
|
|
end else begin
|
|
SELECT *, convert(varchar(20),@layout) as Layout
|
|
FROM #tmpfhr1
|
|
ORDER BY OESort, Sortierung, Name
|
|
end
|
|
|
|
DROP TABLE #tmpfhr
|
|
DROP TABLE #tmpfhr1
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_aufwand_SHU] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_aufwand_SHU]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '31.12.2013 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 24
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
declare @dd1 varchar(2)
|
|
declare @mm1 varchar(2)
|
|
declare @yy1 varchar(4)
|
|
declare @datum varchar(255)
|
|
set @dd1=DAY(@von)
|
|
set @mm1=MONTH(@von)
|
|
set @yy1=YEAR(@von)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 00:00:00'
|
|
set @von=convert(datetime,@datum,20)
|
|
set @dd1=DAY(@bis)
|
|
set @mm1=MONTH(@bis)
|
|
set @yy1=YEAR(@bis)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 23:59:59'
|
|
set @bis=convert(datetime,@datum,20)
|
|
|
|
--'' SET @oestruktur=34
|
|
--'' SET @von = '01.02.2013 00:00:01'
|
|
--'' SET @bis = '28.02.2013 23:59:50'
|
|
|
|
|
|
--DECLARE @per DATETIME = NULL ,
|
|
-- @von DATETIME = NULL ,
|
|
-- @bis DATETIME = NULL
|
|
--SET @per = '01.03.2013'
|
|
--SET @von = '01.03.2013'
|
|
--SET @bis = '31.03.2013'
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
[Paufwand] [float] NOT NULL ,
|
|
[RFC_300] [float] NOT NULL ,
|
|
[CTB] [float] NOT NULL ,
|
|
[RTB] [float] NOT NULL ,
|
|
RFC_200 FLOAT NOT NULL ,
|
|
[Total] [float] NOT NULL ,
|
|
[Soll] [float] NOT NULL ,
|
|
[Prod] [float] NOT NULL ,
|
|
[Anteil_CTB] [float] NOT NULL ,
|
|
[Anteil_RTB] [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Soll_Zeit FLOAT NOT NULL
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
|
|
0.00, 0.00, 0.00, dbo.get_anteil(engagement, MitarbeiterTypNr), dbo.get_arbeitstage(madetails.MADetailNr, year(@von),month(@von))
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE @anzahl FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
-- Honris 200
|
|
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmphono
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE (dbo.honoris_projekt.BOOL2=1
|
|
--( dbo.Honoris_PROJEKT.PROJEKT_NR >= 200 )
|
|
--AND ( dbo.Honoris_PROJEKT.PROJEKT_NR < 300 )
|
|
)
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmphono
|
|
WHERE ( DATUM >= @von
|
|
AND DATUM <= @bis
|
|
)
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rfc_200 = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
DROP TABLE #tmpHono
|
|
-- Honris 300
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmphono1
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE (dbo.honoris_PROJEKT.BOOL3=1 and ( dbo.Honoris_PROJEKT.PROJEKT_NR >= 300 )
|
|
AND ( dbo.Honoris_PROJEKT.PROJEKT_NR <= 399 ))
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmphono1
|
|
WHERE ( DATUM >= @von
|
|
AND DATUM <= @bis
|
|
)
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rfc_300 = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
DROP TABLE #tmphono1
|
|
|
|
-- Honoris <> 300
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmpHono2
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE (dbo.honoris_projekt.BOOL3=1 and ( dbo.Honoris_PROJEKT.PROJEKT_NR < 200 )
|
|
OR ( dbo.Honoris_PROJEKT.PROJEKT_NR > 399 ))
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmpHono2
|
|
WHERE ( DATUM >= @von )
|
|
AND ( DATUM <= @bis )
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET Paufwand = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
DROP TABLE #tmpHono2
|
|
-- IN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(CalculatedValue) AS Expr1, ForUserID
|
|
FROM dbo.TXP_LVer_IN_AU
|
|
WHERE ( ExecutedDateTime >= @von
|
|
AND ExecutedDateTime <= @bis
|
|
)
|
|
AND ( Ticket_ID LIKE N'IN_%' )
|
|
GROUP BY ForUserID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rtb = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
-- AU
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(CalculatedValue) AS Expr1, ForUserID
|
|
FROM dbo.TXP_LVer_IN_AU
|
|
WHERE ( ExecutedDateTime >= @von
|
|
AND ExecutedDateTime <= @bis
|
|
)
|
|
AND ( Ticket_ID LIKE N'AU_%' )
|
|
GROUP BY ForUserID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET ctb = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
UPDATE @tmpa
|
|
SET total = paufwand + rfc_300 + ctb + rtb + rfc_200
|
|
|
|
|
|
|
|
-- Berechnen
|
|
UPDATE @tmpa
|
|
SET soll = ( soll_zeit * @ansatz ) / 100 * Engagement_Effektiv
|
|
|
|
SELECT * FROM @tmpa WHERE tgnummer='tg4507'
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
a.sortierung AS Expr1, a.Paufwand, a.RFC_300, a.CTB, a.RTB, a.RFC_200, a.Total, a.Soll, a.Prod, a.Anteil_CTB, a.Anteil_RTB,
|
|
a.Engagement_Effektiv, a.Soll_Zeit
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN ( SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
SELECT OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1 AS Sort, Engagement_Effektiv, SUM(Paufwand) AS PAufwand, SUM(RFC_300) AS RFC_300,
|
|
SUM(CTB) AS CTB, SUM(RTB) AS RTB, SUM(RFC_200) AS RFC_200, SUM(Total) AS Total, SUM(Soll) AS Soll, CONVERT(NUMERIC(18, 2), 0.00) AS Prod,
|
|
CONVERT(NUMERIC(18, 2), 0.00) AS Anteil_CTB, CONVERT(NUMERIC(18, 2), 0.00) AS Anteil_Rtb
|
|
INTO #tmpfhr1
|
|
FROM #tmpfhr
|
|
GROUP BY OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1, Engagement_Effektiv
|
|
|
|
UPDATE #tmpfhr1
|
|
SET prod = ROUND(total / soll * 100, 2)
|
|
WHERE total > 0
|
|
AND soll > 0
|
|
UPDATE #tmpfhr1
|
|
SET Anteil_CTB = ROUND(( ( paufwand + rfc_300 + ctb ) / Total ) * 100, 2)
|
|
WHERE total > 0
|
|
AND ( paufwand + rfc_300 + ctb ) > 0
|
|
UPDATE #tmpfhr1
|
|
SET Anteil_rtb = ROUND(( ( rfc_200 + rtb ) / total ) * 100, 2)
|
|
WHERE total > 0
|
|
AND ( rfc_200 + rtb ) > 0
|
|
|
|
SELECT *
|
|
FROM #tmpfhr1
|
|
ORDER BY OESort, Sortierung, Name
|
|
|
|
DROP TABLE #tmpfhr
|
|
DROP TABLE #tmpfhr1
|
|
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_aufwand_WPI] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_aufwand_WPI]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:00'
|
|
IF @bis IS NULL
|
|
SET @bis = '31.05.2013 23:59:59'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 25
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
declare @dd1 varchar(2)
|
|
declare @mm1 varchar(2)
|
|
declare @yy1 varchar(4)
|
|
declare @datum varchar(255)
|
|
set @dd1=DAY(@von)
|
|
set @mm1=MONTH(@von)
|
|
set @yy1=YEAR(@von)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 00:00:00'
|
|
set @von=convert(datetime,@datum,20)
|
|
set @dd1=DAY(@bis)
|
|
set @mm1=MONTH(@bis)
|
|
set @yy1=YEAR(@bis)
|
|
if LEN(@dd1)<2 set @dd1='0'+@dd1
|
|
if LEN(@mm1)<2 set @mm1='0'+@mm1
|
|
set @datum=@yy1+'-'+@mm1+'-'+@dd1 +' 22:48:45'
|
|
set @bis=convert(datetime,@datum,20)
|
|
|
|
--'' SET @oestruktur=34
|
|
--'' SET @von = '01.02.2013 00:00:01'
|
|
--'' SET @bis = '28.02.2013 23:59:50'
|
|
|
|
|
|
--DECLARE @per DATETIME = NULL ,
|
|
-- @von DATETIME = NULL ,
|
|
-- @bis DATETIME = NULL
|
|
--SET @per = '01.03.2013'
|
|
--SET @von = '01.03.2013'
|
|
--SET @bis = '31.03.2013'
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
oenr INT ,
|
|
sortierung INT ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
[Paufwand] [float] NOT NULL ,
|
|
[RFC_300] [float] NOT NULL ,
|
|
[CTB] [float] NOT NULL ,
|
|
[RTB] [float] NOT NULL ,
|
|
RFC_200 FLOAT NOT NULL ,
|
|
[Total] [float] NOT NULL ,
|
|
[Soll] [float] NOT NULL ,
|
|
[Prod] [float] NOT NULL ,
|
|
[Anteil_CTB] [float] NOT NULL ,
|
|
[Anteil_RTB] [float] NOT NULL ,
|
|
Engagement_Effektiv FLOAT NOT NULL ,
|
|
Soll_Zeit FLOAT NOT NULL
|
|
)
|
|
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
|
|
INSERT @tmpa
|
|
SELECT TOP 1
|
|
dbo.MA.TGNummer, madetails.OENr, ma.sortierung, @von, @bis, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,
|
|
0.00, 0.00, 0.00, dbo.get_anteil(engagement, MitarbeiterTypNr),
|
|
dbo.get_arbeitstage(madetails.MADetailNr, year(@von),month(@von)) --dbo.get_arbeitstage(year(@von),month(@von))
|
|
FROM dbo.MA
|
|
LEFT OUTER JOIN dbo.MADetails ON dbo.MA.MANr = dbo.MADetails.MANr
|
|
WHERE dbo.MADetails.manr = @mnr
|
|
AND dbo.MADetails.Aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
ORDER BY Gueltig_ab DESC
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
|
|
DECLARE @anzahl FLOAT
|
|
DECLARE @ma VARCHAR(255)
|
|
|
|
-- RTB
|
|
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmphono
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE ( dbo.honoris_projekt.bool2=1
|
|
--AND ( dbo.Honoris_PROJEKT.PROJEKT_NR >= 200 )
|
|
-- AND ( dbo.Honoris_PROJEKT.PROJEKT_NR < 300 )
|
|
)
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmphono
|
|
WHERE ( DATUM >= @von
|
|
AND DATUM <= @bis
|
|
)
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rfc_200 = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
DROP TABLE #tmpHono
|
|
--CTB
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmphono1
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE ( dbo.honoris_projekt.bool3=1 )
|
|
--AND ( dbo.Honoris_PROJEKT.PROJEKT_NR >= 300 )
|
|
-- AND ( dbo.Honoris_PROJEKT.PROJEKT_NR <= 399 ))
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmphono1
|
|
WHERE ( DATUM >= @von
|
|
AND DATUM <= @bis
|
|
)
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET rfc_300 = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
DROP TABLE #tmphono1
|
|
|
|
-- Führung
|
|
SELECT dbo.Honoris_JOURNAL.DATUM, dbo.Honoris_JOURNAL.ANZAHLINT, dbo.Honoris_mitarbeiter.NAME, dbo.Honoris_mitarbeiter.VORNAME,
|
|
dbo.Honoris_PROJEKT.KURZNAME, dbo.Honoris_PROJEKT.BEZEICHNUNG, dbo.Honoris_mitarbeiter.MITARBEITER_ID, dbo.Honoris_JOURNAL.ERFDATUM,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INTO #tmpHono2
|
|
FROM dbo.Honoris_JOURNAL
|
|
INNER JOIN dbo.Honoris_PROJEKT ON dbo.Honoris_JOURNAL.PROJEKT_NR = dbo.Honoris_PROJEKT.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE (dbo.honoris_projekt.bool6=1 )
|
|
--AND ( dbo.Honoris_PROJEKT.PROJEKT_NR < 200 )
|
|
-- OR ( dbo.Honoris_PROJEKT.PROJEKT_NR > 399 ))
|
|
AND dbo.Honoris_PROJEKT.PROJEKT_NR NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT SUM(ANZAHLINT), MITARBEITER_ID
|
|
FROM #tmpHono2
|
|
WHERE ( DATUM >= @von )
|
|
AND ( DATUM <= @bis )
|
|
GROUP BY MITARBEITER_ID
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
UPDATE @tmpa
|
|
SET Paufwand = @anzahl
|
|
WHERE tgnummer = @ma
|
|
AND start = @von
|
|
AND ende = @bis
|
|
FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
DROP TABLE #tmpHono2
|
|
---- IN
|
|
-- DECLARE xc CURSOR
|
|
-- FOR
|
|
-- SELECT SUM(CalculatedValue) AS Expr1, ForUserID
|
|
-- FROM dbo.TXP_LVer_IN_AU
|
|
-- WHERE ( ExecutedDateTime >= @von
|
|
-- AND ExecutedDateTime <= @bis
|
|
-- )
|
|
-- AND ( Ticket_ID LIKE N'IN_%' )
|
|
-- GROUP BY ForUserID
|
|
-- OPEN xc
|
|
-- FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
-- WHILE @@FETCH_STATUS = 0
|
|
-- BEGIN
|
|
-- UPDATE @tmpa
|
|
-- SET rtb = @anzahl
|
|
-- WHERE tgnummer = @ma
|
|
-- AND start = @von
|
|
-- AND ende = @bis
|
|
-- FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
-- END
|
|
-- CLOSE xc
|
|
-- DEALLOCATE xc
|
|
|
|
-- -- AU
|
|
-- DECLARE xc CURSOR
|
|
-- FOR
|
|
-- SELECT SUM(CalculatedValue) AS Expr1, ForUserID
|
|
-- FROM dbo.TXP_LVer_IN_AU
|
|
-- WHERE ( ExecutedDateTime >= @von
|
|
-- AND ExecutedDateTime <= @bis
|
|
-- )
|
|
-- AND ( Ticket_ID LIKE N'AU_%' )
|
|
-- GROUP BY ForUserID
|
|
-- OPEN xc
|
|
-- FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
-- WHILE @@FETCH_STATUS = 0
|
|
-- BEGIN
|
|
|
|
-- UPDATE @tmpa
|
|
-- SET ctb = @anzahl
|
|
-- WHERE tgnummer = @ma
|
|
-- AND start = @von
|
|
-- AND ende = @bis
|
|
|
|
-- FETCH NEXT FROM xc INTO @anzahl, @ma
|
|
-- END
|
|
-- CLOSE xc
|
|
-- DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
UPDATE @tmpa
|
|
--SET total = paufwand + rfc_300 + ctb + rtb + rfc_200
|
|
SET total = rfc_300 +rfc_200
|
|
|
|
|
|
|
|
-- Berechnen
|
|
UPDATE @tmpa
|
|
SET soll = ( soll_zeit * @ansatz ) / 100 * Engagement_Effektiv
|
|
|
|
SELECT TOP ( 100 ) PERCENT
|
|
dbo.OE.Bezeichnung AS OE, dbo.OE.Sortierung AS OESort, dbo.MA.Name, dbo.MA.Vorname, dbo.MA.Sortierung, a.TGNummer, a.START, a.ende,
|
|
a.sortierung AS Expr1, a.Paufwand, a.RFC_300, a.CTB, a.RTB, a.RFC_200, a.Total, a.Soll, a.Prod, a.Anteil_CTB, a.Anteil_RTB,
|
|
a.Engagement_Effektiv, a.Soll_Zeit
|
|
INTO #tmpfhr
|
|
FROM @tmpa a
|
|
INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
WHERE dbo.OE.oenr IN ( SELECT id
|
|
FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
AND dbo.oe.oenr NOT IN ( SELECT item
|
|
FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
ORDER BY OESort, dbo.MA.Sortierung, dbo.MA.Name
|
|
|
|
SELECT OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1 AS Sort, Engagement_Effektiv, SUM(Paufwand) AS PAufwand, SUM(RFC_300) AS RFC_300,
|
|
SUM(CTB) AS CTB, SUM(RTB) AS RTB, SUM(RFC_200) AS RFC_200, SUM(Total) AS Total, SUM(Soll) AS Soll, CONVERT(NUMERIC(18, 2), 0.00) AS Prod,
|
|
CONVERT(NUMERIC(18, 2), 0.00) AS Anteil_CTB, CONVERT(NUMERIC(18, 2), 0.00) AS Anteil_Rtb
|
|
INTO #tmpfhr1
|
|
FROM #tmpfhr
|
|
GROUP BY OE, OESort, Name, Vorname, Sortierung, TGNummer, Expr1, Engagement_Effektiv
|
|
|
|
UPDATE #tmpfhr1
|
|
SET prod = ROUND(total / soll * 100, 2)
|
|
WHERE total > 0
|
|
AND soll > 0
|
|
UPDATE #tmpfhr1
|
|
SET Anteil_CTB = ROUND(( ( rfc_300 ) / Total ) * 100, 2)
|
|
WHERE total > 0
|
|
AND ( rfc_300 ) > 0
|
|
UPDATE #tmpfhr1
|
|
SET Anteil_rtb = ROUND(( ( rfc_200 ) / total ) * 100, 2)
|
|
WHERE total > 0
|
|
AND ( rfc_200 ) > 0
|
|
|
|
PRINT 'a'
|
|
SELECT *,'WPI' as Layout
|
|
FROM #tmpfhr1
|
|
ORDER BY OESort, Sortierung, Name
|
|
|
|
DROP TABLE #tmpfhr
|
|
DROP TABLE #tmpfhr1
|
|
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_checkliste] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_checkliste]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '30.06.2013 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 25
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
DECLARE @tmpa TABLE (tgnummer varchar(255), name varchar(255), kst varchar(255), summe float, projektnr int, projektname varchar (255))
|
|
|
|
INSERT @tmpa EXEC dbo.sp_rpt_fhrlst_projekte_nach_ma @von,@bis, @oestruktur, @struktur_Ausschluss,@Honoris_Ausschluss
|
|
INSERT @tmpa EXEC dbo.sp_rpt_fhrlst_incidents_nach_ma @von,@bis, @oestruktur, @struktur_Ausschluss,@Honoris_Ausschluss
|
|
|
|
|
|
|
|
SELECT TOP (100) PERCENT TGNummer, NAME, KST, SUM(summe) AS Summe, ProjektNr, Projektname
|
|
FROM @tmpa
|
|
GROUP BY TGNummer, NAME, KST, ProjektNr, Projektname
|
|
ORDER BY tgnummer, ProjektNr
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_fuehrung_nach_ma_wpi] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
create PROCEDURE [dbo].[sp_rpt_fhrlst_fuehrung_nach_ma_wpi]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '31.05.2013 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 25
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
NAME VARCHAR(255) ,
|
|
KST VARCHAR(255) ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
anzahl FLOAT ,
|
|
ProjektNr int ,
|
|
Projektname VARCHAR(255) ,
|
|
oenr INT
|
|
)
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @tgnummer VARCHAR(255)
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
DECLARE @oe INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr, TGNummer
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
SELECT @oe = oenr
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
INSERT @tmpa
|
|
SELECT dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME AS Name,
|
|
dbo.Honoris_mitarbeiter.KST, @von, @bis, SUM(dbo.Honoris_JOURNAL.ANZAHLINT) AS Anzahl,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.Kurzname, @oe
|
|
FROM dbo.Honoris_PROJEKT
|
|
INNER JOIN dbo.Honoris_JOURNAL ON dbo.Honoris_PROJEKT.PROJEKT_NR = dbo.Honoris_JOURNAL.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE ( dbo.Honoris_JOURNAL.DATUM >= @von )
|
|
AND ( dbo.Honoris_JOURNAL.DATUM <= @bis )
|
|
AND dbo.Honoris_mitarbeiter.MITARBEITER_id = @tgnummer AND (honoris_projekt.bool6=1)
|
|
GROUP BY dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.kurzname, dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME, dbo.Honoris_mitarbeiter.KST
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
|
|
DEALLOCATE xm
|
|
DELETE FROM @tmpa WHERE projektnr IN ( SELECT item FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr IN ( SELECT item FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr NOT IN ( SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
|
|
--SELECT a.*
|
|
|
|
--FROM @tmpa a
|
|
-- INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
-- INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
--WHERE dbo.OE.oenr IN ( SELECT id
|
|
-- FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- AND dbo.oe.oenr NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
--ORDER BY dbo.MA.Name
|
|
|
|
|
|
SELECT TOP (100) PERCENT TGNummer, NAME, KST, SUM(anzahl) AS Summe, ProjektNr, Projektname
|
|
FROM @tmpa
|
|
GROUP BY TGNummer, NAME, KST, ProjektNr, Projektname
|
|
ORDER BY tgnummer, ProjektNr
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_incidents_nach_ma] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_incidents_nach_ma]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '30.04.2013 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 24
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = '31'
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = '2'
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
NAME VARCHAR(255) ,
|
|
KST VARCHAR(255) ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
anzahl FLOAT ,
|
|
ProjektNr int ,
|
|
Projektname VARCHAR(255) ,
|
|
oenr INT
|
|
)
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @tgnummer VARCHAR(255)
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
DECLARE @oe INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr, TGNummer
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
SELECT @oe = oenr
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
INSERT @tmpa
|
|
SELECT dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME AS Name,
|
|
dbo.Honoris_mitarbeiter.KST, @von, @bis, SUM(dbo.Honoris_JOURNAL.ANZAHLINT) AS Anzahl,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.kurzname, @oe
|
|
FROM dbo.Honoris_PROJEKT
|
|
INNER JOIN dbo.Honoris_JOURNAL ON dbo.Honoris_PROJEKT.PROJEKT_NR = dbo.Honoris_JOURNAL.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE ( dbo.Honoris_JOURNAL.DATUM >= @von )
|
|
AND ( dbo.Honoris_JOURNAL.DATUM <= @bis )
|
|
AND dbo.Honoris_mitarbeiter.MITARBEITER_id = @tgnummer AND honoris_projekt.bool2=1
|
|
GROUP BY dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.kurzname, dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME, dbo.Honoris_mitarbeiter.KST
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
DELETE FROM @tmpa WHERE projektnr IN ( SELECT item FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr IN ( SELECT item FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr NOT IN ( SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
|
|
--SELECT a.*
|
|
|
|
--FROM @tmpa a
|
|
-- INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
-- INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
--WHERE dbo.OE.oenr IN ( SELECT id
|
|
-- FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- AND dbo.oe.oenr NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
--ORDER BY dbo.MA.Name
|
|
|
|
|
|
SELECT TOP (100) PERCENT TGNummer, NAME, KST, SUM(anzahl) AS Summe, ProjektNr, Projektname
|
|
FROM @tmpa
|
|
GROUP BY TGNummer, NAME, KST, ProjektNr, Projektname
|
|
ORDER BY tgnummer, ProjektNr
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_incidents_nach_ma_wpi] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_incidents_nach_ma_wpi]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:00'
|
|
IF @bis IS NULL
|
|
SET @bis = '31.05.2013 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 25
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = '31'
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = '2'
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
NAME VARCHAR(255) ,
|
|
KST VARCHAR(255) ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
anzahl FLOAT ,
|
|
ProjektNr int ,
|
|
Projektname VARCHAR(255) ,
|
|
oenr INT
|
|
)
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @tgnummer VARCHAR(255)
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
DECLARE @oe INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr, TGNummer
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
SELECT @oe = oenr
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
INSERT @tmpa
|
|
SELECT dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME AS Name,
|
|
dbo.Honoris_mitarbeiter.KST, @von, @bis, SUM(dbo.Honoris_JOURNAL.ANZAHLINT) AS Anzahl,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.kurzname, @oe
|
|
FROM dbo.Honoris_PROJEKT
|
|
INNER JOIN dbo.Honoris_JOURNAL ON dbo.Honoris_PROJEKT.PROJEKT_NR = dbo.Honoris_JOURNAL.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE ( dbo.Honoris_JOURNAL.DATUM >= @von )
|
|
AND ( dbo.Honoris_JOURNAL.DATUM <= @bis )
|
|
AND dbo.Honoris_mitarbeiter.MITARBEITER_id = @tgnummer AND honoris_projekt.bool4=1
|
|
GROUP BY dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.kurzname, dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME, dbo.Honoris_mitarbeiter.KST
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
DELETE FROM @tmpa WHERE projektnr IN ( SELECT item FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr IN ( SELECT item FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr NOT IN ( SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
|
|
--SELECT a.*
|
|
|
|
--FROM @tmpa a
|
|
-- INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
-- INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
--WHERE dbo.OE.oenr IN ( SELECT id
|
|
-- FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- AND dbo.oe.oenr NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
--ORDER BY dbo.MA.Name
|
|
|
|
|
|
SELECT TOP (100) PERCENT TGNummer, NAME, KST, SUM(anzahl) AS Summe, ProjektNr, Projektname
|
|
FROM @tmpa
|
|
GROUP BY TGNummer, NAME, KST, ProjektNr, Projektname
|
|
ORDER BY tgnummer, ProjektNr
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_projekte_nach_ma] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_projekte_nach_ma]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '30.04.2013 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 24
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = '31'
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = '2'
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
NAME VARCHAR(255) ,
|
|
KST VARCHAR(255) ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
anzahl FLOAT ,
|
|
ProjektNr int ,
|
|
Projektname VARCHAR(255) ,
|
|
oenr INT
|
|
)
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @tgnummer VARCHAR(255)
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
DECLARE @oe INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr, TGNummer
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
SELECT @oe = oenr
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
INSERT @tmpa
|
|
SELECT dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME AS Name,
|
|
dbo.Honoris_mitarbeiter.KST, @von, @bis, SUM(dbo.Honoris_JOURNAL.ANZAHLINT) AS Anzahl,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.Kurzname, @oe
|
|
FROM dbo.Honoris_PROJEKT
|
|
INNER JOIN dbo.Honoris_JOURNAL ON dbo.Honoris_PROJEKT.PROJEKT_NR = dbo.Honoris_JOURNAL.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE ( dbo.Honoris_JOURNAL.DATUM >= @von )
|
|
AND ( dbo.Honoris_JOURNAL.DATUM <= @bis )
|
|
AND dbo.Honoris_mitarbeiter.MITARBEITER_id = @tgnummer AND (honoris_projekt.bool3=1)
|
|
GROUP BY dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.kurzname, dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME, dbo.Honoris_mitarbeiter.KST
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
DEALLOCATE xm
|
|
DELETE FROM @tmpa WHERE projektnr IN ( SELECT item FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr IN ( SELECT item FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr NOT IN ( SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
|
|
--SELECT a.*
|
|
|
|
--FROM @tmpa a
|
|
-- INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
-- INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
--WHERE dbo.OE.oenr IN ( SELECT id
|
|
-- FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- AND dbo.oe.oenr NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
--ORDER BY dbo.MA.Name
|
|
|
|
|
|
SELECT TOP (100) PERCENT TGNummer, NAME, KST, SUM(anzahl) AS Summe, ProjektNr, Projektname
|
|
FROM @tmpa
|
|
GROUP BY TGNummer, NAME, KST, ProjektNr, Projektname
|
|
ORDER BY tgnummer, ProjektNr
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_fhrlst_projekte_nach_ma_wpi] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_fhrlst_projekte_nach_ma_wpi]
|
|
@von DATETIME = NULL ,
|
|
@bis DATETIME = NULL ,
|
|
@oestruktur INTEGER = NULL ,
|
|
@struktur_Ausschluss VARCHAR(255) = NULL ,
|
|
@Honoris_Ausschluss VARCHAR(255) = NULL
|
|
AS
|
|
BEGIN
|
|
IF @von IS NULL
|
|
SET @von = '01.01.2013 00:00:01'
|
|
IF @bis IS NULL
|
|
SET @bis = '31.05.2013 23:59:50'
|
|
IF @oestruktur IS NULL
|
|
SET @oestruktur = 25
|
|
IF @struktur_ausschluss IS NULL
|
|
SET @struktur_ausschluss = ''
|
|
IF @honoris_ausschluss IS NULL
|
|
SET @honoris_ausschluss = ''
|
|
|
|
DECLARE @dd1 VARCHAR(2)
|
|
DECLARE @mm1 VARCHAR(2)
|
|
DECLARE @yy1 VARCHAR(4)
|
|
DECLARE @datum VARCHAR(255)
|
|
SET @dd1 = DAY(@von)
|
|
SET @mm1 = MONTH(@von)
|
|
SET @yy1 = YEAR(@von)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 00:00:00'
|
|
SET @von = CONVERT(DATETIME, @datum, 20)
|
|
SET @dd1 = DAY(@bis)
|
|
SET @mm1 = MONTH(@bis)
|
|
SET @yy1 = YEAR(@bis)
|
|
IF LEN(@dd1) < 2
|
|
SET @dd1 = '0' + @dd1
|
|
IF LEN(@mm1) < 2
|
|
SET @mm1 = '0' + @mm1
|
|
SET @datum = @yy1 + '-' + @mm1 + '-' + @dd1 + ' 23:59:59'
|
|
SET @bis = CONVERT(DATETIME, @datum, 20)
|
|
|
|
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @tmpa TABLE
|
|
(
|
|
[TGNummer] [varchar](50) NULL ,
|
|
NAME VARCHAR(255) ,
|
|
KST VARCHAR(255) ,
|
|
START DATETIME ,
|
|
Ende DATETIME ,
|
|
anzahl FLOAT ,
|
|
ProjektNr int ,
|
|
Projektname VARCHAR(255) ,
|
|
oenr INT
|
|
)
|
|
DECLARE @ansatz FLOAT
|
|
SET @ansatz = 8.0
|
|
|
|
--IF @per IS NULL
|
|
-- SET @per = GETDATE()
|
|
|
|
|
|
--***************************************************************************
|
|
-- Relevante Mitarbeiter am Per-Datum
|
|
--***************************************************************************
|
|
DECLARE @mnr INT
|
|
DECLARE @tgnummer VARCHAR(255)
|
|
DECLARE @rc INT
|
|
DECLARE @mm INT
|
|
DECLARE @yy INT
|
|
DECLARE @oe INT
|
|
|
|
DECLARE xm CURSOR
|
|
FOR
|
|
SELECT *
|
|
FROM dbo.get_monatstabelle(@von, @bis)
|
|
ORDER BY start_date
|
|
OPEN xm
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
DECLARE xc CURSOR
|
|
FOR
|
|
SELECT manr, TGNummer
|
|
FROM ma
|
|
WHERE aktiv = 1
|
|
AND gueltig_bis >= @bis
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
WHILE @@FETCH_STATUS = 0
|
|
BEGIN
|
|
SELECT @rc = COUNT(*)
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
IF @rc > 0
|
|
BEGIN
|
|
SELECT @oe = oenr
|
|
FROM dbo.MADetails
|
|
WHERE manr = @mnr
|
|
AND aktiv = 1
|
|
AND Gueltig_ab <= @von
|
|
|
|
INSERT @tmpa
|
|
SELECT dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME AS Name,
|
|
dbo.Honoris_mitarbeiter.KST, @von, @bis, SUM(dbo.Honoris_JOURNAL.ANZAHLINT) AS Anzahl,
|
|
dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.Kurzname, @oe
|
|
FROM dbo.Honoris_PROJEKT
|
|
INNER JOIN dbo.Honoris_JOURNAL ON dbo.Honoris_PROJEKT.PROJEKT_NR = dbo.Honoris_JOURNAL.PROJEKT_NR
|
|
INNER JOIN dbo.Honoris_mitarbeiter ON dbo.Honoris_JOURNAL.MITARBEITER_NR = dbo.Honoris_mitarbeiter.MITARBEITER_NR
|
|
WHERE ( dbo.Honoris_JOURNAL.DATUM >= @von )
|
|
AND ( dbo.Honoris_JOURNAL.DATUM <= @bis )
|
|
AND dbo.Honoris_mitarbeiter.MITARBEITER_id = @tgnummer AND (honoris_projekt.bool5=1)
|
|
GROUP BY dbo.Honoris_PROJEKT.PROJEKT_NR, dbo.Honoris_PROJEKT.kurzname, dbo.Honoris_mitarbeiter.MITARBEITER_ID,
|
|
dbo.Honoris_mitarbeiter.NAME + ' ' + dbo.Honoris_mitarbeiter.VORNAME, dbo.Honoris_mitarbeiter.KST
|
|
|
|
END
|
|
FETCH NEXT FROM xc INTO @mnr, @tgnummer
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
FETCH NEXT FROM xm INTO @von, @bis
|
|
END
|
|
|
|
CLOSE xm
|
|
|
|
DEALLOCATE xm
|
|
DELETE FROM @tmpa WHERE projektnr IN ( SELECT item FROM dbo.fnkt_split(@Honoris_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr IN ( SELECT item FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
DELETE FROM @tmpa WHERE oenr NOT IN ( SELECT id FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
|
|
--SELECT a.*
|
|
|
|
--FROM @tmpa a
|
|
-- INNER JOIN dbo.MA ON a.TGNummer = dbo.MA.TGNummer
|
|
-- INNER JOIN dbo.OE ON a.oenr = dbo.OE.OeNr
|
|
--WHERE dbo.OE.oenr IN ( SELECT id
|
|
-- FROM dbo.fnkt_get_kpi_hierarchie(@oestruktur) )
|
|
-- AND dbo.oe.oenr NOT IN ( SELECT item
|
|
-- FROM dbo.fnkt_split(@struktur_Ausschluss, ',', 1) )
|
|
--ORDER BY dbo.MA.Name
|
|
|
|
|
|
SELECT TOP (100) PERCENT TGNummer, NAME, KST, SUM(anzahl) AS Summe, ProjektNr, Projektname
|
|
FROM @tmpa
|
|
GROUP BY TGNummer, NAME, KST, ProjektNr, Projektname
|
|
ORDER BY tgnummer, ProjektNr
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_get_applikation] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_get_applikation]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
set @xsql = 'SELECT * from dbo.applview '
|
|
set @xsql = @xsql + ' where applikationnr=' + @sqlwhere
|
|
print @xsql
|
|
exec(@xsql)
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_get_auswertungparameter] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_get_auswertungparameter]
|
|
@auswertungnr int
|
|
as
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
SELECT dbo.Auswertungsparameter.Auswertungparameternr, dbo.Auswertungsparameter.Bezeichnung, dbo.Auswertungsparameter.Operator,
|
|
dbo.Auswertungsparameter.Feldbezug, dbo.Auswertungsparameter.Wert, dbo.Auswertungsparameter.ParamName, dbo.AuswertungAuswertungParameter.DBfeldname,
|
|
dbo.Auswertungsparameter.ParamType, dbo.AuswertungAuswertungParameter.Auswertungnr, dbo.AuswertungAuswertungParameter.Reihenfolge,
|
|
ISNULL(dbo.Auswertungsparameter.fix,0) AS fix, ISNULL(dbo.Auswertungsparameter.fixoperator,'') AS fixOperator,
|
|
ISNULL(dbo.auswertungsparameter.Visible,1) AS visible, ISNULL(dbo.Auswertungsparameter.Defaultvalue,'') AS defaultvalue,
|
|
ISNULL(dbo.Auswertungsparameter.Editable,1) AS Editable,isnull(dbo.Auswertungsparameter.param_name,'') AS Param_name,
|
|
ISNULL(dbo.Auswertungsparameter.fixandor,'and') AS FixAndOr
|
|
FROM dbo.AuswertungAuswertungParameter INNER JOIN
|
|
dbo.Auswertungsparameter ON dbo.AuswertungAuswertungParameter.Auswertungparameternr = dbo.Auswertungsparameter.Auswertungparameternr
|
|
WHERE (dbo.Auswertungsparameter.Aktiv = 1) AND (dbo.AuswertungAuswertungParameter.Aktiv = 1) AND (dbo.AuswertungAuswertungParameter.Auswertungnr = @auswertungnr)
|
|
ORDER BY dbo.AuswertungAuswertungParameter.Reihenfolge
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_iga] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_iga]
|
|
|
|
@sqlwhere varchar(1024)
|
|
|
|
AS
|
|
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
|
|
set @xsql='select * from view_igadata '
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' and (' + @sqlwhere + ') '
|
|
end
|
|
|
|
-- set @xsql='SELECT dbo.GremiumGruppierung.Gruppierungsbegriff AS [Group], dbo.GremiumBereich.Bereich AS Gremium, dbo.GremiumBereich.Beschreibung,'
|
|
|
|
-- set @xsql=@xsql+' dbo.Person.Name, dbo.Person.Vorname, dbo.Kontakttyp.Bezeichnung AS Rollle, dbo.GremiumPerson.Leitung,'
|
|
|
|
-- set @xsql=@xsql+' dbo.GremiumPerson.Beschreibung AS PersonBeschreibung, dbo.Vertragspartner.NameZ1 + ' + char(39) + ' ' + char(39) +' + dbo.Vertragspartner.NameZ2 AS Firma'
|
|
|
|
-- set @xsql=@xsql+' FROM dbo.GremiumBereich INNER JOIN'
|
|
|
|
-- set @xsql=@xsql+' dbo.GremiumPerson ON dbo.GremiumBereich.GremiumBereichNr = dbo.GremiumPerson.GremiumBereichNr INNER JOIN'
|
|
|
|
-- set @xsql=@xsql+' dbo.Person ON dbo.GremiumPerson.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
|
|
-- set @xsql=@xsql+' dbo.GremiumGruppierung ON dbo.GremiumBereich.GremiumGruppierungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN'
|
|
|
|
-- set @xsql=@xsql+' dbo.Gremium ON dbo.GremiumGruppierung.GremiumNr = dbo.Gremium.GremiumNr INNER JOIN'
|
|
|
|
-- set @xsql=@xsql+' dbo.Vertragspartner ON dbo.Person.Vertragspartnernr = dbo.Vertragspartner.VertragspartnerNr LEFT OUTER JOIN'
|
|
|
|
-- set @xsql=@xsql+' dbo.Kontakttyp ON dbo.GremiumPerson.RolleNr = dbo.Kontakttyp.KontakttypNr'
|
|
|
|
-- set @xsql=@xsql+' WHERE (dbo.GremiumBereich.Aktiv = 1) AND (dbo.GremiumPerson.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.Gremium.GremiumNr = 5) and (dbo.GremiumGruppierung.GremiumGruppierungNr=50)'
|
|
|
|
|
|
|
|
-- if @sqlwhere <> '' begin
|
|
|
|
-- set @xsql=@xsql+' and (' + @sqlwhere + ') '
|
|
|
|
-- end
|
|
|
|
-- set @xsql = @xsql + ' ORDER BY dbo.gremiumbereich.bereich, dbo.gremiumperson.leitung desc, dbo.person.name '
|
|
|
|
--print @xsql
|
|
|
|
|
|
|
|
end
|
|
|
|
exec(@xsql)
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_ikv] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_ikv]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
SELECT TOP (100) PERCENT dbo.Applikation.ApplikationNr, dbo.Applikation.Bezeichnung, dbo.Applikation_IKV_Relevanztyp.Bezeichnung AS Geschaeftsrelevanz,
|
|
dbo.Applikation_IKV_Ausfalldauer.Bezeichnung AS Max_Ausfalldauer, dbo.Applikation.IKVProviderVereinbart AS IKV_Vereinbart,
|
|
dbo.Applikation_IKV_VereinbarteAusfalldauer.Bezeichnung AS Vereinbarte_Ausfalldauer, dbo.Applikation_IKV_LoesungTyp.Bezeichnung AS Loesungsart,
|
|
dbo.Applikation_IKV_Test.Durchgeführt AS IKV_Test_Durchgefuehrt, dbo.Applikation_IKV_TestResultat.Bezeichnung AS ikv_Test_Resultat,
|
|
dbo.Applikation_IKV_Test.Geplant AS ikv_test_geplant, dbo.Applikation_IKV_Test.Aktiv
|
|
into #tmpd
|
|
FROM dbo.Applikation_IKV_TestResultat INNER JOIN
|
|
dbo.Applikation_IKV_Test ON
|
|
dbo.Applikation_IKV_TestResultat.IKVTestResultatnr = dbo.Applikation_IKV_Test.Applikation_IKV_TestResultatNr RIGHT OUTER JOIN
|
|
dbo.Applikation ON dbo.Applikation_IKV_Test.ApplikationNr = dbo.Applikation.ApplikationNr LEFT OUTER JOIN
|
|
dbo.Applikation_IKV_LoesungTyp ON dbo.Applikation.IKVLoesungNr = dbo.Applikation_IKV_LoesungTyp.IKVLoesungTypnr LEFT OUTER JOIN
|
|
dbo.Applikation_IKV_VereinbarteAusfalldauer ON
|
|
dbo.Applikation.IKVProviderAussfalldauerNr = dbo.Applikation_IKV_VereinbarteAusfalldauer.IKVVereinbarteAusfalldauernr LEFT OUTER JOIN
|
|
dbo.Applikation_IKV_Ausfalldauer ON dbo.Applikation.IKVBizAusfalldauerNr = dbo.Applikation_IKV_Ausfalldauer.IKVAusfalldauernr LEFT OUTER JOIN
|
|
dbo.Applikation_IKV_Relevanztyp ON dbo.Applikation.IKVBizRelevanzNr = dbo.Applikation_IKV_Relevanztyp.IKVRelevanztypnr
|
|
WHERE (dbo.Applikation.Aktiv = 1)
|
|
|
|
alter table #tmpd add rowcounter integer
|
|
delete from #tmpd where aktiv=0
|
|
declare @anr INT
|
|
DECLARE @c int
|
|
DECLARE xc cursor FOR
|
|
SELECT ApplikationNr FROM #tmpd
|
|
OPEN xc
|
|
FETCH NEXT FROM xc INTO @anr
|
|
WHILE @@FETCH_STATUS=0 begin
|
|
SELECT @c=COUNT(*) FROM #tmpd WHERE ApplikationNr=@anr AND ikv_test_geplant IS NOT null
|
|
|
|
UPDATE #tmpd SET rowcounter=@c WHERE ApplikationNr=@anr
|
|
fetch NEXT FROM xc INTO @anr
|
|
END
|
|
CLOSE xc
|
|
DEALLOCATE xc
|
|
|
|
IF @sqlwhere='Geschaeftsrelevanz = ' + char(39) +'Ja'+CHAR(39) begin
|
|
select distinct * from #tmpd order by bezeichnung
|
|
END ELSE BEGIN
|
|
SELECT distinct * From #tmpd where not Geschaeftsrelevanz is null
|
|
end
|
|
|
|
|
|
return
|
|
|
|
--SELECT TOP (100) PERCENT dbo.applikation.ApplikationNr,dbo.Applikation.Bezeichnung, dbo.Applikation_IKV_Relevanztyp.Bezeichnung AS Geschaeftsrelevanz,
|
|
-- dbo.Applikation_IKV_Ausfalldauer.Bezeichnung AS Max_Ausfalldauer, isnull(dbo.Applikation.IKVProviderVereinbart,0) AS IKV_Vereinbart,
|
|
-- dbo.Applikation_IKV_VereinbarteAusfalldauer.Bezeichnung AS Vereinbarte_Ausfalldauer, dbo.Applikation_IKV_LoesungTyp.Bezeichnung AS Loesungsart,
|
|
-- dbo.applikation.Aktiv
|
|
--into #tmpd
|
|
--FROM dbo.Applikation LEFT OUTER JOIN
|
|
-- dbo.Applikation_IKV_LoesungTyp ON dbo.Applikation.IKVLoesungNr = dbo.Applikation_IKV_LoesungTyp.IKVLoesungTypnr LEFT OUTER JOIN
|
|
-- dbo.Applikation_IKV_VereinbarteAusfalldauer ON
|
|
-- dbo.Applikation.IKVProviderAussfalldauerNr = dbo.Applikation_IKV_VereinbarteAusfalldauer.IKVVereinbarteAusfalldauernr LEFT OUTER JOIN
|
|
-- dbo.Applikation_IKV_Ausfalldauer ON dbo.Applikation.IKVBizAusfalldauerNr = dbo.Applikation_IKV_Ausfalldauer.IKVAusfalldauernr LEFT OUTER JOIN
|
|
-- dbo.Applikation_IKV_Relevanztyp ON dbo.Applikation.IKVBizRelevanzNr = dbo.Applikation_IKV_Relevanztyp.IKVRelevanztypnr
|
|
--where dbo.applikation.Aktiv=1
|
|
|
|
--alter table #tmpd add IKV_Test_Durchgefuehrt datetime null
|
|
--alter table #tmpd add ikv_Test_Resultat varchar(255) null
|
|
--alter table #tmpd add ikv_test_geplant datetime null
|
|
|
|
--declare @anr int
|
|
--declare @durchgefuehrt datetime
|
|
--declare @resultat datetime
|
|
--declare @resultattext varchar(255)
|
|
|
|
--declare xc cursor for
|
|
-- select applikationnr from #tmpd
|
|
--open xc
|
|
--fetch next from xc into @anr
|
|
--while @@FETCH_STATUS=0 begin
|
|
-- set @durchgefuehrt = CONVERT(DATETIME, '1900-01-01 00:00:00', 102)
|
|
-- select top 1 @durchgefuehrt=durchgeführt, @resultat=Applikation_IKV_TestResultatNr from Applikation_IKV_Test where ApplikationNr=@anr and Aktiv=1 order by Durchgeführt desc
|
|
-- if @durchgefuehrt > CONVERT(DATETIME, '1900-01-01 00:00:00', 102) begin
|
|
-- select @resultattext=bezeichnung from Applikation_IKV_TestResultat where Applikation_IKV_TestResultat.IKVTestResultatnr=@resultat
|
|
-- update #tmpd set IKV_Test_Durchgefuehrt=@durchgefuehrt, ikv_Test_Resultat=@resultattext where applikationnr=@anr
|
|
-- end
|
|
-- set @durchgefuehrt = CONVERT(DATETIME, '1900-01-01 00:00:00', 102)
|
|
-- select top 1 @durchgefuehrt=geplant from Applikation_IKV_Test where ApplikationNr=@anr and Aktiv=1
|
|
-- and durchgeführt=CONVERT(DATETIME, '1900-01-01 00:00:00',102) order by Geplant desc
|
|
-- if @durchgefuehrt > CONVERT(DATETIME, '1900-01-01 00:00:00', 102) begin
|
|
-- update #tmpd set ikv_test_geplant=@durchgefuehrt where applikationnr=@anr
|
|
-- end
|
|
-- fetch next from xc into @anr
|
|
--end
|
|
--close xc
|
|
--deallocate xc
|
|
|
|
--IF @sqlwhere='Geschaeftsrelevanz = ' + char(39) +'Ja'+CHAR(39) begin
|
|
-- select distinct * from #tmpd where bezeichnung<>'' order by bezeichnung
|
|
--END ELSE BEGIN
|
|
-- SELECT distinct * From #tmpd where not Geschaeftsrelevanz is null
|
|
--end
|
|
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_ikv_berechtigung] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_ikv_berechtigung]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
SELECT distinct
|
|
[tgnummer]
|
|
,[name]
|
|
,[vorname]
|
|
,'Leseberechtigung' as Typ
|
|
into #tmp1
|
|
FROM [Vertragsverwaltung].[dbo].[View_IKV_Berechtigungseinschraenkung]
|
|
where readonly=1 and invisible=0
|
|
order by name
|
|
|
|
insert #tmp1
|
|
SELECT distinct TOP 1000
|
|
[tgnummer]
|
|
,[name]
|
|
,[vorname]
|
|
,'Keine Rechte' as Typ
|
|
FROM [Vertragsverwaltung].[dbo].[View_IKV_Berechtigungseinschraenkung]
|
|
where readonly=1 and invisible=1
|
|
order by name
|
|
|
|
insert #tmp1
|
|
SELECT distinct TOP 1000
|
|
[tgnummer]
|
|
,[name]
|
|
,[vorname]
|
|
,'Keine Rechte' as Typ
|
|
FROM [Vertragsverwaltung].[dbo].[View_IKV_Berechtigungseinschraenkung]
|
|
where readonly=0 and invisible=1
|
|
order by name
|
|
|
|
--select * from #tmp1 order by name
|
|
--return
|
|
|
|
insert #tmp1
|
|
select tgnummer, name, vorname ,'Update Rechte' from mitarbeiter where aktiv=1 and tgnummer not in (select tgnummer from #tmp1) and mitarbeiternr in (select mitarbeiternr from mitarbeiter_funktionsgruppe where aktiv=1)
|
|
|
|
select tgnummer, name, vorname ,'Update Rechte' as typ into #tmp2 from mitarbeiter where aktiv=1 and tgnummer not in (select tgnummer from #tmp1) and mitarbeiternr in (select mitarbeiternr from mitarbeiter_funktionsgruppe where aktiv=1)
|
|
|
|
|
|
delete from #tmp1 where tgnummer in (select tgnummer from #tmp2)
|
|
insert #tmp1 select * from #tmp2
|
|
drop table #tmp2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from #tmp1 order by name, vorname
|
|
drop table #tmp1
|
|
|
|
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_ITKoordinatoren] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_ITKoordinatoren]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
CREATE TABLE #tmpd(
|
|
[Reihenfolge] [int] null,
|
|
[Gruppierungsbegriff] [varchar](50) NULL,
|
|
[Bereich] [varchar](50) NULL,
|
|
[Sortierung] [int] NULL,
|
|
[ITK] [varchar](50) NULL,
|
|
[ITK_Tel] [varchar](50) NULL,
|
|
[ITK_Mail] [varchar](50) NULL,
|
|
[ITK1] [varchar](50) NULL,
|
|
[ITK1_Tel] [varchar](50) NULL,
|
|
[ITK1_Mail] [varchar](50) NULL,
|
|
[ITK2] [varchar](50) NULL,
|
|
[ITK2_Tel] [varchar](50) NULL,
|
|
[ITK2_Mail] [varchar](50) NULL
|
|
) ON [DEFAULT]
|
|
SET NOCOUNT ON;
|
|
|
|
declare @gnr int
|
|
declare @gbeg varchar(50)
|
|
declare @r int
|
|
declare @bnr int
|
|
declare @bbe varchar (50)
|
|
declare @bs int
|
|
declare @bcnt int
|
|
declare @itk varchar(50)
|
|
declare @itk_tel varchar(50)
|
|
declare @itk_mail varchar(50)
|
|
declare @itk1 varchar(50)
|
|
declare @itk1_tel varchar(50)
|
|
declare @itk1_mail varchar(50)
|
|
declare @itk2 varchar(50)
|
|
declare @itk2_tel varchar(50)
|
|
declare @itk2_mail varchar(50)
|
|
|
|
|
|
declare xc cursor for
|
|
SELECT dbo.GremiumGruppierung.GremiumGruppierungnr ,dbo.GremiumGruppierung.Gruppierungsbegriff, dbo.GremiumGruppierung.Reihenfolge
|
|
FROM dbo.Gremium INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Gremium.GremiumNr = dbo.GremiumGruppierung.GremiumNr
|
|
WHERE (dbo.GremiumGruppierung.Aktiv = 1) AND (dbo.Gremium.Aktiv = 1) AND (dbo.Gremium.GremiumNr = 2)
|
|
ORDER BY dbo.GremiumGruppierung.Reihenfolge
|
|
open xc
|
|
fetch next from xc into @gnr, @gbeg, @r
|
|
while @@fetch_status=0 begin
|
|
|
|
set @bcnt=0
|
|
declare x1 cursor for
|
|
select gremiumbereichnr, bereich, sortierung from gremiumbereich where gremiumgruppierungnr=@gnr and aktiv=1
|
|
open x1
|
|
fetch next from x1 into @bnr, @bbe, @bs
|
|
while @@fetch_status=0 begin
|
|
set @bcnt=@bcnt+1
|
|
--IT-Koordinator
|
|
SELECT @itk=dbo.Person.Name + ' ' + dbo.Person.Vorname, @itk_tel=dbo.Person.Telefon,@itk_mail=dbo.Person.email
|
|
FROM dbo.GremiumPerson INNER JOIN dbo.Person ON dbo.GremiumPerson.PersonNr = dbo.Person.PersonNr
|
|
WHERE dbo.GremiumPerson.GremiumBereichNr = @bnr AND dbo.GremiumPerson.RolleNr = 9 and dbo.gremiumperson.aktiv=1
|
|
if @@rowcount=0 begin
|
|
set @itk=''
|
|
set @itk_tel=''
|
|
set @itk_mail=''
|
|
end
|
|
--STV1
|
|
SELECT @itk1=dbo.Person.Name + ' ' + dbo.Person.Vorname, @itk1_tel=dbo.Person.Telefon,@itk1_mail=dbo.Person.email
|
|
FROM dbo.GremiumPerson INNER JOIN dbo.Person ON dbo.GremiumPerson.PersonNr = dbo.Person.PersonNr
|
|
WHERE dbo.GremiumPerson.GremiumBereichNr = @bnr AND dbo.GremiumPerson.RolleNr = 10 and dbo.gremiumperson.aktiv=1
|
|
if @@rowcount=0 begin
|
|
set @itk1=''
|
|
set @itk1_tel=''
|
|
set @itk1_mail=''
|
|
end
|
|
|
|
--STV2
|
|
SELECT @itk2=dbo.Person.Name + ' ' + dbo.Person.Vorname, @itk2_tel=dbo.Person.Telefon,@itk2_mail=dbo.Person.email
|
|
FROM dbo.GremiumPerson INNER JOIN dbo.Person ON dbo.GremiumPerson.PersonNr = dbo.Person.PersonNr
|
|
WHERE dbo.GremiumPerson.GremiumBereichNr = @bnr AND dbo.GremiumPerson.RolleNr = 11 and dbo.gremiumperson.aktiv=1
|
|
if @@rowcount=0 begin
|
|
set @itk2=''
|
|
set @itk2_tel=''
|
|
set @itk2_mail=''
|
|
end
|
|
|
|
insert #tmpd(reihenfolge, gruppierungsbegriff, bereich, sortierung,itk, itk_tel, itk_mail, itk1, itk1_tel, itk1_mail, itk2, itk2_tel, itk2_mail)
|
|
values (@r, @gbeg, @bbe, @bs, @itk, @itk_tel, @itk_mail, @itk1, @itk1_tel, @itk1_mail, @itk2, @itk2_tel, @itk2_mail)
|
|
|
|
fetch next from x1 into @bnr, @bbe, @bs
|
|
end
|
|
close x1
|
|
deallocate x1
|
|
if @bcnt=0 begin
|
|
insert #tmpd(reihenfolge, gruppierungsbegriff, bereich, sortierung,itk, itk_tel, itk_mail, itk1, itk1_tel, itk1_mail, itk2, itk2_tel, itk2_mail)
|
|
values (@r, @gbeg, '',0,'','','','','','','','','')
|
|
end
|
|
|
|
|
|
fetch next from xc into @gnr, @gbeg, @r
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
|
|
select * from #tmpd order by reihenfolge, sortierung
|
|
drop table #tmpd
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_key_user_nach_applikation_team] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_key_user_nach_applikation_team]
|
|
@sqlwhere varchar(1024)
|
|
as
|
|
SELECT DISTINCT
|
|
TOP 100 PERCENT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon,
|
|
LEN(dbo.Person.Telefon) - 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr,
|
|
dbo.ApplikationKategorie.Bezeichnung AS Kategorie, dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung,
|
|
GremiumGruppierung_1.Gruppierungsbegriff AS Marktbereich, dbo.GremiumBereich.Bereich
|
|
FROM dbo.ApplikationKontakt INNER JOIN
|
|
dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN
|
|
dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN
|
|
dbo.GremiumGruppierung GremiumGruppierung_1 ON
|
|
dbo.Applikation.Marktbereichnr = GremiumGruppierung_1.GremiumGruppierungNr LEFT OUTER JOIN
|
|
dbo.GremiumBereich ON dbo.Applikation.ApplikationTeamnr = dbo.GremiumBereich.GremiumBereichNr
|
|
WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR
|
|
dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumGruppierung.GremiumNr = 3) AND (GremiumGruppierung_1.GremiumNr = 4) AND
|
|
(dbo.GremiumBereich.GremiumGruppierungNr = 3)
|
|
ORDER BY Applikation, dbo.Kontakttyp.KontakttypNr
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_keyuser_nach_applikation] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_keyuser_nach_applikation]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
|
|
SELECT DISTINCT
|
|
dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, LEN(dbo.Person.Telefon)
|
|
- 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie,
|
|
dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung, GremiumGruppierung_1.Beschreibung AS Marktbereich
|
|
FROM dbo.ApplikationKontakt INNER JOIN
|
|
dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN
|
|
dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN
|
|
dbo.GremiumGruppierung AS GremiumGruppierung_1 ON dbo.Applikation.Marktbereichnr = GremiumGruppierung_1.GremiumGruppierungNr
|
|
WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR
|
|
dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumGruppierung.GremiumNr = 3) AND (GremiumGruppierung_1.GremiumNr = 4)
|
|
ORDER BY Applikation, dbo.Kontakttyp.KontakttypNr-- SELECT DISTINCT TOP (100) PERCENT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname,
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_keyuser_nach_applikation_rfcboard] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_keyuser_nach_applikation_rfcboard]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
SELECT DISTINCT
|
|
dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, SUBSTRING(dbo.Person.Telefon, LEN(dbo.Person.Telefon)
|
|
- 4, 5) AS telefon, dbo.Person.EMail, dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr, dbo.ApplikationKategorie.Bezeichnung AS Kategorie,
|
|
dbo.GremiumGruppierung.Gruppierungsbegriff AS Verantwortung, GremiumGruppierung_1.Gruppierungsbegriff AS Marktbereich, dbo.Applikation.RfcBoardNr,
|
|
dbo.GremiumBereich.Bereich AS RFCBoard
|
|
FROM dbo.ApplikationKontakt INNER JOIN
|
|
dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN
|
|
dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN
|
|
dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Applikation.ApplikationVerantwortungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN
|
|
dbo.GremiumGruppierung AS GremiumGruppierung_1 ON dbo.Applikation.Marktbereichnr = GremiumGruppierung_1.GremiumGruppierungNr INNER JOIN
|
|
dbo.GremiumBereich ON dbo.Applikation.RfcBoardNr = dbo.GremiumBereich.GremiumBereichNr
|
|
WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.ApplikationKontakt.Aktiv = 1) AND (dbo.GremiumGruppierung.GremiumNr = 3) AND
|
|
(GremiumGruppierung_1.GremiumNr = 4) AND (dbo.Kontakttyp.KontakttypNr = 1 OR
|
|
dbo.Kontakttyp.KontakttypNr = 2) AND (dbo.GremiumBereich.GremiumGruppierungNr = 1)
|
|
ORDER BY Applikation, dbo.Kontakttyp.KontakttypNr-- substring(dbo.person.telefon,len(dbo.person.telefon)-4,5) as telefon
|
|
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_keyuser_nach_Keyuser] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rpt_keyuser_nach_Keyuser]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
SELECT DISTINCT dbo.Applikation.Bezeichnung AS Applikation, dbo.Person.Name, dbo.Person.Vorname, dbo.Person.Telefon, dbo.Person.EMail,
|
|
dbo.Kontakttyp.Bezeichnung AS Kontakttyp, dbo.Kontakttyp.KontakttypNr
|
|
FROM dbo.ApplikationKontakt INNER JOIN
|
|
dbo.Kontakttyp ON dbo.ApplikationKontakt.KontakttypNr = dbo.Kontakttyp.KontakttypNr INNER JOIN
|
|
dbo.Person ON dbo.ApplikationKontakt.PersonNr = dbo.Person.PersonNr INNER JOIN
|
|
dbo.Applikation ON dbo.ApplikationKontakt.Applikationnr = dbo.Applikation.ApplikationNr
|
|
WHERE (dbo.Applikation.Aktiv = 1) AND (dbo.Person.Aktiv = 1) AND (dbo.Kontakttyp.KontakttypNr = 1 OR
|
|
dbo.Kontakttyp.KontakttypNr = 2)
|
|
ORDER BY dbo.Person.Name, dbo.Person.Vorname, Applikation, dbo.Kontakttyp.KontakttypNr
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_kuendigungsfristen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
-- =============================================
|
|
|
|
-- Author: <Author,,Name>
|
|
|
|
-- Create date: <Create Date,,>
|
|
|
|
-- Description: <Description,,>
|
|
|
|
-- =============================================
|
|
|
|
CREATE PROCEDURE [dbo].[sp_rpt_kuendigungsfristen]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
SELECT 0 as periode,dbo.Vertragsereignis.ereignisnr, dbo.Vertragspartner.NameZ1, dbo.Vertragspartner.NameZ2, dbo.Vertragspartner.PLZ, dbo.Vertragspartner.Ort, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Vertragsereignis.Bezeichnung AS Ereignis, dbo.Kuendigungsfristen.Bezeichnung AS Kuendigungsfrist, dbo.Periodizitaet.Bezeichnung AS Periodizitaet
|
|
,dbo.Get_Next_Kuendigungstermin(dbo.Vertragsereignis.EreignisNr) AS Termin
|
|
into #tmp_kuendigungstermine
|
|
FROM dbo.Vertragsereignis INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragsereignis.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Kuendigungsfristen ON dbo.Vertragsereignis.Kuendigungsfristnr = dbo.Kuendigungsfristen.KuendigungsfristNr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Vertragsereignis.PeriodizitaetNr = dbo.Periodizitaet.PeriodizitaetNr
|
|
WHERE (dbo.Vertragsereignis.Aktiv = 1 AND dbo.Vertragselement.Aktiv = 1 AND dbo.Vertragspartner.Aktiv = 1 AND dbo.Kuendigungsfristen.Aktiv = 1 AND
|
|
dbo.Periodizitaet.Aktiv = 1) AND
|
|
(dbo.Vertragsereignis.EreignistypNr = 1 OR dbo.Vertragsereignis.EreignistypNr = 4)
|
|
and dbo.periodizitaet.periodizitaetnr <> 15
|
|
|
|
insert #tmp_kuendigungstermine
|
|
SELECT 1 as periode,dbo.Vertragsereignis.ereignisnr, dbo.Vertragspartner.NameZ1, dbo.Vertragspartner.NameZ2, dbo.Vertragspartner.PLZ, dbo.Vertragspartner.Ort, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Vertragsereignis.Bezeichnung AS Ereignis, dbo.Kuendigungsfristen.Bezeichnung AS Kuendigungsfrist, dbo.Periodizitaet.Bezeichnung AS Periodizitaet
|
|
,dbo.Get_Next_Kuendigungstermin(dbo.Vertragsereignis.EreignisNr) AS Termin
|
|
FROM dbo.Vertragsereignis INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragsereignis.Vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Kuendigungsfristen ON dbo.Vertragsereignis.Kuendigungsfristnr = dbo.Kuendigungsfristen.KuendigungsfristNr INNER JOIN
|
|
dbo.Periodizitaet ON dbo.Vertragsereignis.PeriodizitaetNr = dbo.Periodizitaet.PeriodizitaetNr
|
|
WHERE (dbo.Vertragsereignis.Aktiv = 1 AND dbo.Vertragselement.Aktiv = 1 AND dbo.Vertragspartner.Aktiv = 1 AND dbo.Kuendigungsfristen.Aktiv = 1 AND
|
|
dbo.Periodizitaet.Aktiv = 1) AND
|
|
(dbo.Vertragsereignis.EreignistypNr = 1 OR dbo.Vertragsereignis.EreignistypNr = 4)
|
|
and dbo.periodizitaet.periodizitaetnr = 15
|
|
|
|
select * from #tmp_kuendigungstermine where termin > '01.01.1900'
|
|
drop table #tmp_kuendigungstermine
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_Lizenzauswertung] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_Lizenzauswertung]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @rnd int
|
|
declare @tmptabl1 varchar(255)
|
|
declare @xsql varchar(2048)
|
|
declare @datum varchar(10)
|
|
|
|
SELECT @rnd=CAST(RAND() * 100 AS INT)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
set @tmptabl1='dbo.'+@tmptabl1
|
|
|
|
-- =============================================
|
|
-- Query ausführen
|
|
-- =============================================
|
|
set @datum='1900-01-01'
|
|
|
|
set @xsql='SELECT CASE WHEN Applikation_1.Bezeichnung IS NULL THEN applikation.bezeichnung ELSE applikation_1.bezeichnung END AS Applikation,'
|
|
set @xsql=@xsql+' dbo.Applikation.Bezeichnung AS Modul, dbo.ApplikationVersion.Version, CASE WHEN dbo.applikationversion.eingesetzt = 1 THEN '+char(39) + 'Ja' + char(39)+ ' ELSE ' + char(39) + 'Nein' + char(39) + ' END AS Installiert, '
|
|
set @xsql=@xsql+' dbo.Lizenztyp.Bezeichnung AS Lizenztyp, dbo.Lizenzkauf.Anzahl AS Expr1, CASE WHEN applikation_1.bezeichnung IS NULL'
|
|
set @xsql=@xsql+' THEN CASE WHEN dbo.applikation.inaktivseit < '+ char(39) + @datum + char(39) +' THEN '+char(39) + 'Inaktiv' + char(39) +' ELSE '+char(39) + 'Aktiv' + char(39) +' END ELSE CASE WHEN applikation_1.inaktivseit < '+ char(39) + @datum + char(39) +' THEN '+char(39) + 'Inaktiv' + char(39) +' ELSE '+char(39) + 'Aktiv' + char(39) +''
|
|
set @xsql=@xsql+' END END AS Applikation_Aktiv'
|
|
set @xsql = @xsql + ' into ' + @tmptabl1
|
|
set @xsql=@xsql+' FROM dbo.VertragselementApplikation INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Lizenzkauf ON dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.Lizenzkauf.Vertragselementapplikationnr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation AS Applikation_1 ON dbo.Applikation.ParentID = Applikation_1.ApplikationNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationVersion ON dbo.Applikation.ApplikationNr = dbo.ApplikationVersion.ApplikationNr AND'
|
|
set @xsql=@xsql+' dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Lizenzkauf.Aktiv = 1)'
|
|
|
|
execute (@xsql)
|
|
|
|
|
|
set @xsql = ' SELECT Applikation, Modul, Version, Installiert, Lizenztyp, SUM(Expr1) AS Anzahl, Applikation_Aktiv '
|
|
set @xsql = @xsql + ' FROM ' + @tmptabl1
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' where ' + @sqlwhere
|
|
end
|
|
set @xsql = @xsql +' GROUP BY Applikation, Modul, Version, Installiert, Lizenztyp, Applikation_Aktiv '
|
|
execute (@xsql)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
|
|
end
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_Lizenzauswertung_neu] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_Lizenzauswertung_neu]
|
|
@sqlwhere varchar(255)
|
|
AS
|
|
BEGIN
|
|
declare @rnd int
|
|
declare @tmptabl1 varchar(255)
|
|
declare @xsql varchar(4096)
|
|
declare @datum varchar(10)
|
|
|
|
SELECT @rnd=CAST(RAND() * 100 AS INT)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
set @tmptabl1='dbo.'+@tmptabl1
|
|
|
|
-- =============================================
|
|
-- Query ausführen
|
|
-- =============================================
|
|
set @datum='1900-02-01'
|
|
|
|
set @xsql='SELECT dbo.Applikation.Bezeichnung AS Applikation, dbo.Lizenz.Bezeichnung AS Lizenz'
|
|
set @xsql=@xsql + ', dbo.Lizenzkauf.Anzahl, isnull(dbo.ApplikationVersion.Version,'+char(39)+char(39)+') as Version '
|
|
set @xsql=@xsql + ', dbo.Lizenztyp.Bezeichnung as Lizenztyp'
|
|
set @xsql=@xsql + ', CASE WHEN dbo.applikation.inaktivseit > '+ char(39) + @datum + char(39) +' THEN '+char(39) + 'Inaktiv' + char(39) +' ELSE '+char(39) + 'Aktiv' + char(39) + ' end as Applikation_Aktiv'
|
|
set @xsql=@xsql + ', case when dbo.lizenzkauf.aktiv=1 then ' + char(39)+'Aktiv' + char(39) +' else ' + char(39)+'Inaktiv'+char(39)+' end as lizenz_aktiv '
|
|
set @xsql=@xsql + ' into ' + @tmptabl1
|
|
set @xsql=@xsql + ' FROM dbo.Lizenz INNER JOIN '
|
|
set @xsql=@xsql + ' dbo.LizenzVertragselementApplikation ON dbo.Lizenz.LizenzNr = dbo.LizenzVertragselementApplikation.Lizenznr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.VertragselementApplikation ON '
|
|
set @xsql=@xsql + ' dbo.LizenzVertragselementApplikation.VertragselementApplikationNr = dbo.VertragselementApplikation.VertragselementApplikationnr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.Lizenzkauf ON dbo.Lizenz.LizenzNr = dbo.Lizenzkauf.Lizenznr AND '
|
|
set @xsql=@xsql + ' dbo.LizenzVertragselementApplikation.LizenzVEApplNr = dbo.Lizenzkauf.Vertragselementapplikationnr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr LEFT OUTER JOIN'
|
|
set @xsql=@xsql + ' dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr'
|
|
set @xsql=@xsql + ' where dbo.lizenz.aktiv=1'
|
|
--WHERE (dbo.LizenzVertragselementApplikation.Aktiv = 1) AND (dbo.Lizenzkauf.Aktiv = 1) AND (dbo.Applikation.Aktiv = 1) AND
|
|
--(dbo.VertragselementApplikation.Aktiv = 1)
|
|
print @xsql
|
|
execute (@xsql)
|
|
|
|
set @xsql='select * from ' + @tmptabl1 + ' order by applikation'
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Filterung und selektion
|
|
-- =============================================
|
|
set @xsql='select distinct applikation, lizenz, isnull(sum(anzahl),0) as anzahl,lizenztyp, Applikation_aktiv, Lizenz_Aktiv'
|
|
--set @xsql=@xsql + ' into vertragsverwaltung.dbo.__Lizenzauswertung '
|
|
set @xsql=@xsql+' from ' + @tmptabl1
|
|
if @sqlwhere<>'' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere
|
|
end
|
|
set @xsql=@xsql+' GROUP BY Applikation, Lizenz,Lizenztyp, Applikation_Aktiv, Lizenz_Aktiv'
|
|
execute (@xsql)
|
|
--select @xsql
|
|
--return
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
END
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_Lizenzauswertung_neu_detail] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_Lizenzauswertung_neu_detail]
|
|
@sqlwhere varchar(255)
|
|
AS
|
|
BEGIN
|
|
declare @rnd int
|
|
declare @tmptabl1 varchar(255)
|
|
declare @xsql varchar(4096)
|
|
declare @datum varchar(10)
|
|
|
|
SELECT @rnd=CAST(RAND() * 100 AS INT)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
set @tmptabl1='dbo.'+@tmptabl1
|
|
|
|
-- =============================================
|
|
-- Query ausführen
|
|
-- =============================================
|
|
set @datum='1900-02-01'
|
|
|
|
set @xsql='SELECT dbo.Applikation.Bezeichnung AS Applikation, dbo.Lizenz.Bezeichnung AS Lizenz'
|
|
set @xsql=@xsql + ', dbo.Lizenzkauf.Anzahl, isnull(dbo.ApplikationVersion.Version,'+char(39)+char(39)+') as Version '
|
|
set @xsql=@xsql + ', dbo.Lizenztyp.Bezeichnung as Lizenztyp'
|
|
set @xsql=@xsql + ', CASE WHEN dbo.applikation.inaktivseit > '+ char(39) + @datum + char(39) +' THEN '+char(39) + 'Inaktiv' + char(39) +' ELSE '+char(39) + 'Aktiv' + char(39) + ' end as Applikation_Aktiv'
|
|
set @xsql=@xsql + ', case when dbo.lizenzkauf.aktiv=1 then ' + char(39)+'Aktiv' + char(39) +' else ' + char(39)+'Inaktiv'+char(39)+' end as lizenz_aktiv '
|
|
set @xsql=@xsql + ', dbo.Lizenzkauf.Kaufdatum, dbo.Lizenzkauf.KGNummer AS Auftragsnummer '
|
|
set @xsql=@xsql + ', dbo.Lizenzkauf.SAPNummer, dbo.Lizenzkauf.Gueltigbis, dbo.Lizenzkauf.Bemerkung'
|
|
|
|
set @xsql=@xsql + ' into ' + @tmptabl1
|
|
set @xsql=@xsql + ' FROM dbo.Lizenz INNER JOIN '
|
|
set @xsql=@xsql + ' dbo.LizenzVertragselementApplikation ON dbo.Lizenz.LizenzNr = dbo.LizenzVertragselementApplikation.Lizenznr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.VertragselementApplikation ON '
|
|
set @xsql=@xsql + ' dbo.LizenzVertragselementApplikation.VertragselementApplikationNr = dbo.VertragselementApplikation.VertragselementApplikationnr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.Lizenzkauf ON dbo.Lizenz.LizenzNr = dbo.Lizenzkauf.Lizenznr AND '
|
|
set @xsql=@xsql + ' dbo.LizenzVertragselementApplikation.LizenzVEApplNr = dbo.Lizenzkauf.Vertragselementapplikationnr INNER JOIN'
|
|
set @xsql=@xsql + ' dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr LEFT OUTER JOIN'
|
|
set @xsql=@xsql + ' dbo.ApplikationVersion ON dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr'
|
|
set @xsql=@xsql + ' where dbo.lizenz.aktiv=1'
|
|
print @xsql
|
|
execute (@xsql)
|
|
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Filterung und selektion
|
|
-- =============================================
|
|
set @xsql='select * '
|
|
-- distinct applikation, lizenz, isnull(sum(anzahl),0) as anzahl,lizenztyp, Applikation_aktiv, Lizenz_Aktiv'
|
|
--set @xsql=@xsql + ' into vertragsverwaltung.dbo.__Lizenzauswertung_detail '
|
|
set @xsql=@xsql+' from ' + @tmptabl1
|
|
if @sqlwhere<>'' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere
|
|
end
|
|
--set @xsql=@xsql+' GROUP BY Applikation, Lizenz,Lizenztyp, Applikation_Aktiv, Lizenz_Aktiv'
|
|
execute (@xsql)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_Lizenzauswertung_r2] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_Lizenzauswertung_r2]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @rnd int
|
|
declare @tmptabl1 varchar(255)
|
|
declare @xsql varchar(2048)
|
|
declare @datum varchar(10)
|
|
|
|
SELECT @rnd=CAST(RAND() * 100 AS INT)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
set @tmptabl1='dbo.'+@tmptabl1
|
|
|
|
-- =============================================
|
|
-- Query ausführen
|
|
-- =============================================
|
|
set @datum='1900-01-01'
|
|
|
|
set @xsql='SELECT CASE WHEN Applikation_1.Bezeichnung IS NULL THEN applikation.bezeichnung ELSE applikation_1.bezeichnung END AS Applikation,'
|
|
set @xsql=@xsql+' dbo.Applikation.Bezeichnung AS Modul, dbo.ApplikationVersion.Version, CASE WHEN dbo.applikationversion.eingesetzt = 1 THEN '+char(39) + 'Ja' + char(39)+ ' ELSE ' + char(39) + 'Nein' + char(39) + ' END AS Installiert, '
|
|
set @xsql=@xsql+' dbo.Lizenztyp.Bezeichnung AS Lizenztyp, dbo.Lizenzkauf.Anzahl AS Expr1, CASE WHEN applikation_1.bezeichnung IS NULL'
|
|
set @xsql=@xsql+' THEN CASE WHEN dbo.applikation.inaktivseit < '+ char(39) + @datum + char(39) +' THEN '+char(39) + 'Inaktiv' + char(39) +' ELSE '+char(39) + 'Aktiv' + char(39) +' END ELSE CASE WHEN applikation_1.inaktivseit < '+ char(39) + @datum + char(39) +' THEN '+char(39) + 'Inaktiv' + char(39) +' ELSE '+char(39) + 'Aktiv' + char(39) +''
|
|
set @xsql=@xsql+' END END AS Applikation_Aktiv, dbo.lizenzkauf.Kaufdatum'
|
|
set @xsql = @xsql + ' into ' + @tmptabl1
|
|
set @xsql=@xsql+' FROM dbo.VertragselementApplikation INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation ON dbo.VertragselementApplikation.Applikationnr = dbo.Applikation.ApplikationNr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Lizenzkauf ON dbo.VertragselementApplikation.VertragselementApplikationnr = dbo.Lizenzkauf.Vertragselementapplikationnr INNER JOIN'
|
|
set @xsql=@xsql+' dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.Applikation AS Applikation_1 ON dbo.Applikation.ParentID = Applikation_1.ApplikationNr LEFT OUTER JOIN'
|
|
set @xsql=@xsql+' dbo.ApplikationVersion ON dbo.Applikation.ApplikationNr = dbo.ApplikationVersion.ApplikationNr AND'
|
|
set @xsql=@xsql+' dbo.VertragselementApplikation.ApplikationVersionNr = dbo.ApplikationVersion.ApplikationVersionNr'
|
|
set @xsql=@xsql+' WHERE (dbo.Lizenzkauf.Aktiv = 1)'
|
|
|
|
execute (@xsql)
|
|
|
|
|
|
set @xsql = ' SELECT Applikation, Modul, Version, Installiert, Lizenztyp, SUM(Expr1) AS Anzahl, Applikation_Aktiv, Kaufdatum '
|
|
set @xsql = @xsql + ' FROM ' + @tmptabl1
|
|
if @sqlwhere <> '' begin
|
|
set @xsql = @xsql + ' where ' + @sqlwhere
|
|
end
|
|
set @xsql = @xsql +' GROUP BY Applikation, Modul, Version, Installiert, Lizenztyp, Applikation_Aktiv, Kaufdatum '
|
|
execute (@xsql)
|
|
|
|
-- =============================================
|
|
-- Temporäre Tabelle löschen
|
|
-- =============================================
|
|
set @tmptabl1 = str(@rnd)
|
|
while left(@tmptabl1,1)=' ' begin
|
|
set @tmptabl1=right(@tmptabl1,len(@tmptabl1)-1)
|
|
end
|
|
set @tmptabl1 = 'tmp_mfp_' + @tmptabl1
|
|
IF EXISTS (SELECT name FROM sysobjects WHERE name = @tmptabl1) begin
|
|
set @xsql = 'drop table dbo.' + @tmptabl1
|
|
execute (@xsql)
|
|
end
|
|
|
|
end
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_oema] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_oema]
|
|
AS
|
|
BEGIN
|
|
|
|
|
|
|
|
SELECT manr AS id ,
|
|
NULL AS Parentid ,
|
|
name + ' ' + vorname AS Bezeichnung ,
|
|
1 AS imageindex ,
|
|
name + ' ' + vorname AS ErweiterteSuche ,
|
|
0 AS Sort
|
|
INTO #tmp2
|
|
FROM dbo.ma where aktiv=1
|
|
|
|
INSERT #tmp2
|
|
( id ,
|
|
parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
ErweiterteSuche ,
|
|
sort
|
|
)
|
|
VALUES ( '0' ,
|
|
NULL ,
|
|
'Root' ,
|
|
0 ,
|
|
' ' ,
|
|
1
|
|
)
|
|
UPDATE #tmp2
|
|
SET parentid = 0
|
|
WHERE id <> 0
|
|
SELECT *
|
|
FROM #tmp2
|
|
ORDER BY parentid ,
|
|
sort ,
|
|
Bezeichnung
|
|
DROP TABLE #tmp2
|
|
|
|
RETURN
|
|
END
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_rfcboard] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Hutter,,Stefan>
|
|
-- Create date: <29.03.2009>
|
|
-- Description: <RFCBoard ausgeben>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_rfcboard]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
|
|
set @xsql = 'SELECT dbo.GremiumBereich.Bereich as RFC_Board, dbo.GremiumBereich.Beschreibung, dbo.Person.Name, dbo.Person.Vorname, dbo.Kontakttyp.Bezeichnung as Rollle, dbo.GremiumPerson.Leitung, dbo.GremiumPerson.Beschreibung as PersonBeschreibung '
|
|
set @xsql = @xsql + ' FROM dbo.GremiumBereich INNER JOIN'
|
|
set @xsql = @xsql + ' dbo.GremiumPerson ON dbo.GremiumBereich.GremiumBereichNr = dbo.GremiumPerson.GremiumBereichNr INNER JOIN'
|
|
set @xsql = @xsql + ' dbo.Person ON dbo.GremiumPerson.PersonNr = dbo.Person.PersonNr INNER JOIN'
|
|
set @xsql = @xsql + ' dbo.GremiumGruppierung ON dbo.GremiumBereich.GremiumGruppierungNr = dbo.GremiumGruppierung.GremiumGruppierungNr INNER JOIN '
|
|
set @xsql = @xsql + ' dbo.Gremium ON dbo.GremiumGruppierung.GremiumNr = dbo.Gremium.GremiumNr LEFT OUTER JOIN '
|
|
set @xsql = @xsql + ' dbo.Kontakttyp ON dbo.GremiumPerson.RolleNr = dbo.Kontakttyp.KontakttypNr '
|
|
set @xsql = @xsql + ' WHERE ((dbo.gremiumbereich.aktiv=1) and (dbo.GremiumPerson.Aktiv = 1) AND (dbo.Person.Aktiv = 1) and dbo.Gremium.GremiumNr = 1) '
|
|
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' and (' + @sqlwhere + ') '
|
|
end
|
|
set @xsql = @xsql + ' ORDER BY dbo.gremiumbereich.bereich, dbo.gremiumperson.leitung desc, dbo.person.name '
|
|
|
|
--set @xsql = 'SELECT dbo.RfcBoard.Bezeichnung as RfcBoard, dbo.RfcBoard_Mitarbeiter.Leiter as Leitung , dbo.Person.Name, dbo.Person.Vorname '
|
|
---set @xsql = @xsql + ' FROM dbo.RfcBoard INNER JOIN '
|
|
--set @xsql = @xsql + ' dbo.RfcBoard_Mitarbeiter ON dbo.RfcBoard.RfcBoardNr = dbo.RfcBoard_Mitarbeiter.RfcBoardNr INNER JOIN '
|
|
-- set @xsql = @xsql + ' dbo.Person ON dbo.RfcBoard_Mitarbeiter.Personnr = dbo.Person.PersonNr '
|
|
--set @xsql = @xsql + ' WHERE (dbo.RfcBoard.Aktiv = 1) AND (dbo.RfcBoard_Mitarbeiter.Aktiv = 1) AND (dbo.Person.Aktiv = 1) '
|
|
--if @sqlwhere <> '' begin
|
|
-- set @xsql=@xsql+' and (' + @sqlwhere + ') '
|
|
--end
|
|
--set @xsql = @xsql + ' ORDER BY dbo.RfcBoard.Bezeichnung, dbo.RfcBoard_Mitarbeiter.Leiter'
|
|
end
|
|
print @xsql
|
|
exec(@xsql)
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_schutz_der_daten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_schutz_der_daten]
|
|
@sqlwhere VARCHAR(1024)
|
|
AS
|
|
BEGIN
|
|
DECLARE @xsql VARCHAR(2048)
|
|
|
|
SET @xsql = 'SELECT dbo.ApplikationKategorie.Bezeichnung AS Applikationskategorie, dbo.Applikation.Bezeichnung AS Applikation, dbo.SDDaten.Bezeichnung AS ArtDerDaten,'
|
|
SET @xsql = @xsql
|
|
+ ' dbo.Applikation.SensitiveDatenBemerkung AS Bemerkung, ISNULL(dbo.SDAdministrator.Bezeichnung, '+CHAR(39)+CHAR(39)+') AS Administriert_durch, dbo.Applikation.SensitiveDatenUserBemerkung AS ArtDesSchutzes'
|
|
SET @xsql = @xsql + ' FROM dbo.Applikation INNER JOIN'
|
|
SET @xsql = @xsql
|
|
+ ' dbo.ApplikationKategorie ON dbo.Applikation.ApplikationKategorieNr = dbo.ApplikationKategorie.ApplikationKategorieNr LEFT OUTER JOIN'
|
|
SET @xsql = @xsql
|
|
+ ' dbo.SDAdministrator ON dbo.Applikation.SensitiveDatenAdministriertdurch = dbo.SDAdministrator.SDAdministratorNr LEFT OUTER JOIN'
|
|
SET @xsql = @xsql
|
|
+ ' dbo.SDDaten ON dbo.Applikation.SensitiveDaten = dbo.SDDaten.SDDatenNr'
|
|
SET @xsql = @xsql + ' WHERE (dbo.Applikation.Aktiv = 1)'
|
|
IF @sqlwhere <> ''
|
|
BEGIN
|
|
SET @xsql = @xsql + ' and ' + @sqlwhere
|
|
END
|
|
EXEC(@xsql)
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_security] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_security]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
-- SELECT dbo.rolle.rollenr, dbo.rolle.bezeichnung, dbo.SecurityObject.SecurityObjectNr, dbo.SecurityObject.SecurityForm,
|
|
-- dbo.SecurityObject.SecurityObjectType, dbo.SecurityObject.SecurityObject, dbo.SecurityObject.SecurityObjectItem, dbo.SecurityObject.SecurityObjectDescriotion,
|
|
-- [level]
|
|
-- into #tmpa
|
|
-- from dbo.securityobject
|
|
-- WHERE (dbo.SecurityObject.Aktiv = 1) AND (dbo.SecurityObject.SecurityObjectType LIKE 'menustrip%' OR
|
|
-- dbo.SecurityObject.SecurityObjectType LIKE 'toolstrip%' OR
|
|
-- dbo.SecurityObject.SecurityObjectType LIKE 'tabpage') AND (dbo.SecurityObject.SecurityObject LIKE 'toolstrip%' OR
|
|
-- dbo.SecurityObject.SecurityObject LIKE 'menustrip%' OR
|
|
-- dbo.SecurityObject.SecurityObject LIKE 'tab%')
|
|
--
|
|
--
|
|
-- declare @bez varchar(255)
|
|
-- declare @xsql varchar(255)
|
|
-- declare xc cursor for
|
|
-- select bezeichnung from rolle where aktiv=1 order by bezeichnung
|
|
-- open xc
|
|
-- fetch next from xc into @bez
|
|
-- while @@fetch_status=0 begin
|
|
-- set @xsql='alter table #tmpa add [' + @bez + '] varchar(255)'
|
|
-- exec (@xsql)
|
|
-- fetch next from xc into @bez
|
|
-- end
|
|
-- close xc
|
|
-- deallocate xc
|
|
|
|
|
|
SELECT dbo.rolle.rollenr, dbo.rolle.bezeichnung, dbo.SecurityObject.SecurityObjectNr, dbo.SecurityObject.SecurityForm,
|
|
dbo.SecurityObject.SecurityObjectType, dbo.SecurityObject.SecurityObject, dbo.SecurityObject.SecurityObjectItem, dbo.SecurityObject.SecurityObjectDescriotion,
|
|
[level], ' ' as Erlaubt, 0 as sortkey
|
|
into #tmpa
|
|
FROM dbo.rolle CROSS JOIN
|
|
dbo.SecurityObject
|
|
WHERE (dbo.SecurityObject.Aktiv = 1) AND (dbo.rolle.aktiv = 1) AND (dbo.SecurityObject.SecurityObjectType LIKE 'menustrip%' OR
|
|
dbo.SecurityObject.SecurityObjectType LIKE 'toolstrip%' OR
|
|
dbo.SecurityObject.SecurityObjectType LIKE 'tabpage') AND (dbo.SecurityObject.SecurityObject LIKE 'toolstrip%' OR
|
|
dbo.SecurityObject.SecurityObject LIKE 'menustrip%' OR
|
|
dbo.SecurityObject.SecurityObject LIKE 'tab%')
|
|
order by securityobjectnr
|
|
|
|
update #tmpa set SecurityObjectItem = securityobject, securityobject=SecurityObjectItem where SecurityObjectItem like 'tab%'
|
|
update #tmpa set securityform = substring(securityform,4,len(securityform)-3)
|
|
|
|
update #tmpa set securityobject = substring(securityobject,1,4) where securityobject like 'Menu%'
|
|
update #tmpa set securityobjectitem = substring(securityobjectitem,1,len(securityobjectitem))
|
|
|
|
update #tmpa set securityobject = substring(securityobject,1,9) where securityobject like 'Toolstrip%'
|
|
update #tmpa set securityobjectitem = substring(securityobjectitem,6,len(securityobjectitem)-4) where securityobjectitem like 'tsbtn%'
|
|
update #tmpa set securityobjectitem = substring(securityobjectitem,7,len(securityobjectitem)-5) where securityobjectitem like 'ts2btn%'
|
|
|
|
update #tmpa set securityobjectitem = SecurityObjectDescriotion, SecurityObjectDescriotion='' where securityobject='Menu' and level=0
|
|
update #tmpa set securityobjectitem='' where securityobject='menu' and level<>0
|
|
|
|
update #tmpa set securityobjectitem='Toolstrip', SecurityObjectDescriotion='' where securityobjecttype='toolstrip' and level = 0
|
|
update #tmpa set SecurityObjectDescriotion=securityobjectitem where securityobjecttype='toolstrip' and level <> '0'
|
|
update #tmpa set securityobjectitem='' where securityobjecttype='toolstrip' and level <> 0
|
|
|
|
update #tmpa set securityobjectitem=SecurityObjectDescriotion where securityobjecttype='tabpage'
|
|
update #tmpa set SecurityObjectDescriotion='' where securityobjecttype='tabpage'
|
|
|
|
declare @k1 int
|
|
declare @k2 int
|
|
declare @sk int
|
|
declare @read int
|
|
declare @inv int
|
|
declare @xsql varchar(255)
|
|
set @sk=0
|
|
declare xc cursor for
|
|
select rollenr, SecurityObjectNr from #tmpa
|
|
open xc
|
|
fetch next from xc into @k1, @k2
|
|
while @@fetch_status=0 begin
|
|
update #tmpa set sortkey=@sk where SecurityObjectNr=@k2
|
|
set @sk=@sk+1
|
|
fetch next from xc into @k1, @k2
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
declare aa cursor for select rollenr, securityobjectnr, readonly, invisible from rolle_securityobject where aktiv=1
|
|
open aa
|
|
fetch next from aa into @k1, @k2, @read, @inv
|
|
while @@fetch_status=0 begin
|
|
if @read=1 and @inv=1 update #tmpa set erlaubt=3 where rollenr=@k1 and securityobjectnr=@k2
|
|
if @read=1 and @inv=0 update #tmpa set erlaubt=2 where rollenr=@k1 and securityobjectnr=@k2
|
|
if @read=0 and @inv=1 update #tmpa set erlaubt=1 where rollenr=@k1 and securityobjectnr=@k2
|
|
fetch next from aa into @k1, @k2, @read, @inv
|
|
end
|
|
close aa
|
|
deallocate aa
|
|
--select * from #tmpa where securityform = 'vertragsuebersicht' and bezeichnung like 'systema%' order by sortkey
|
|
if @sqlwhere <> '' begin
|
|
set @xsql='select * from #tmpa where ' + @sqlwhere + ' order by sortkey'
|
|
end else begin
|
|
set @xsql='select * from #tmpa order by sortkey'
|
|
end
|
|
exec(@xsql)
|
|
|
|
drop table #tmpa
|
|
-- select * from #tmpa order by sortkey
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--ORDER BY dbo.rolle.bezeichnung, dbo.SecurityObject.SecurityForm, dbo.SecurityObject.SecurityObject
|
|
-- SELECT SecurityObjectNr, SecurityForm, SecurityObjectType, SecurityObject, SecurityObjectItem, SecurityObjectDescriotion, 0 as visible, 0 as readonly
|
|
-- into #tmpa
|
|
-- FROM SecurityObject
|
|
-- where securityform = 'frmdummy'
|
|
--
|
|
-- declare @secform varchar(255)
|
|
-- declare xc cursor for
|
|
-- select distinct securityform from dbo.securityobject where aktiv=1
|
|
-- open xc
|
|
-- fetch next from xc into @secform
|
|
-- while @@fetch_status = 0 begin
|
|
-- insert #tmpa
|
|
-- select SecurityObjectNr, SecurityForm, SecurityObjectType, SecurityObject, SecurityObjectItem, SecurityObjectDescriotion,0,0
|
|
-- from securityobject
|
|
-- where SecurityForm=@secform and aktiv=1 order by securityobjectnr
|
|
-- fetch next from xc into @secform
|
|
-- end
|
|
-- close xc
|
|
-- deallocate xc
|
|
-- select * from #tmpa
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_ServerInventar_MA] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rpt_ServerInventar_MA]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
set @xsql='SELECT * from dbo.serverinventar2 order by server, umgebung, kategorie'
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
end
|
|
exec(@xsql)
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_ServerInventar_OA] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rpt_ServerInventar_OA]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
declare @xsql varchar(2048)
|
|
set @xsql='SELECT * from dbo.serverinventar1 order by server, umgebung, kategorie'
|
|
if @sqlwhere <> '' begin
|
|
set @xsql=@xsql+' where ' + @sqlwhere + ' '
|
|
end
|
|
end
|
|
exec(@xsql)
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_txpapplikationen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rpt_txpapplikationen]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON;
|
|
declare @xsql varchar(4096)
|
|
select * from dbo.View_ITSM_TXP_Appl order by Applikation
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_Vertragselement_nach_SecurityLevel] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_Vertragselement_nach_SecurityLevel]
|
|
@sqlwhere varchar(1024)
|
|
AS
|
|
|
|
SELECT dbo.SecurityLevel.Bezeichnung AS SecurityLevel, dbo.SecurityLevel.Aktiv, dbo.Vertragstyp.Vertragstyp, dbo.Vertragselement.Bezeichnung AS Vertragselement,
|
|
dbo.Vertragselement.Aktiv AS Expr2
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.SecurityLevel ON dbo.Vertragselement.SecurityLevelNr = dbo.SecurityLevel.SecurityLevelNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rpt_vertragspruefung] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rpt_vertragspruefung]
|
|
@sqlwhere varchar(1024)
|
|
as
|
|
declare @p int
|
|
-- Ohne Kontakte
|
|
set @p=charindex('ohne Kontakte',@sqlwhere)
|
|
if @p>0 begin
|
|
SELECT dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.Ort AS Vertragspartner,
|
|
dbo.Vertragselement.Bezeichnung + '/ ' + dbo.Vertragselement.Nummer AS Vertragselement, dbo.Vertragstyp.Vertragstyp
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
WHERE (dbo.Vertragselement.Aktiv = 1) AND (dbo.Vertragselement.Vertragselementnr NOT IN
|
|
(SELECT VertragselementNr
|
|
FROM dbo.Vertragskontakt
|
|
WHERE (Aktiv = 1)))
|
|
ORDER BY Vertragspartner, Vertragselement
|
|
return
|
|
end
|
|
|
|
-- Ohne Ereignisse
|
|
set @p=charindex('ohne Ereignisse',@sqlwhere)
|
|
if @p>0 begin
|
|
SELECT dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.Ort AS Vertragspartner,
|
|
dbo.Vertragselement.Bezeichnung + '/ ' + dbo.Vertragselement.Nummer AS Vertragselement, dbo.Vertragstyp.Vertragstyp
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
WHERE (dbo.Vertragselement.Aktiv = 1) AND (dbo.Vertragselement.Vertragselementnr NOT IN
|
|
(SELECT Vertragselementnr
|
|
FROM dbo.Vertragsereignis
|
|
WHERE (Aktiv = 1)))
|
|
ORDER BY Vertragspartner, Vertragselement
|
|
return
|
|
end
|
|
|
|
-- Ohne Bezeichnung
|
|
set @p=charindex('Beschreibungen',@sqlwhere)
|
|
if @p>0 begin
|
|
SELECT dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.Ort AS Vertragspartner,
|
|
dbo.Vertragselement.Bezeichnung + '/ ' + dbo.Vertragselement.Nummer AS Vertragselement, dbo.Vertragstyp.Vertragstyp, dbo.Vertragselement.Beschreibung
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
WHERE (dbo.Vertragselement.Aktiv = 1) and (dbo.vertragselement.beschreibung ='' or dbo.vertragselement.beschreibung like '-%')
|
|
and dbo.vertragstyp.vertragstyp <> 'Lizenzvertrag'
|
|
ORDER BY Vertragspartner, Vertragselement
|
|
return
|
|
end
|
|
|
|
-- Ohne Dokumente
|
|
set @p=charindex('ohne Dokumente',@sqlwhere)
|
|
if @p>0 begin
|
|
SELECT dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.Ort AS Vertragspartner,
|
|
dbo.Vertragselement.Bezeichnung + '/ ' + dbo.Vertragselement.Nummer AS Vertragselement, dbo.Vertragstyp.Vertragstyp
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
WHERE (dbo.Vertragselement.Aktiv = 1) AND (dbo.Vertragselement.Vertragselementnr NOT IN
|
|
(SELECT KeyValue
|
|
FROM dbo.Dokument
|
|
WHERE (DokType = 1) AND (Aktiv = 1)))
|
|
ORDER BY Vertragspartner, Vertragselement
|
|
return
|
|
end
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_Applikation] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rptparams_get_Applikation]
|
|
AS
|
|
BEGIN
|
|
SELECT TOP 100 PERCENT dbo.applikation.applikationnr as keyvalue, dbo.applikation.bezeichnung as bezeichnung
|
|
from dbo.Applikation
|
|
order by bezeichnung
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_applikationskategorie] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rptparams_get_applikationskategorie]
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
select applikationkategorienr as keyvalue, bezeichnung from dbo.applikationkategorie where aktiv=1 order by bezeichnung
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_artderdaten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
create PROCEDURE [dbo].[sp_rptparams_get_artderdaten]
|
|
as
|
|
select sddatennr as keyvalue, bezeichnung from sddaten where aktiv=1 order by bezeichnung
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_Datenbank] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rptparams_get_Datenbank]
|
|
AS
|
|
BEGIN
|
|
SELECT distinct 0 as keyvalue, dbo.ApplikationArchitekturObjectDB.datenbank as bezeichnung
|
|
from dbo.ApplikationArchitekturObjectDB
|
|
order by bezeichnung
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_OE] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rptparams_get_OE]
|
|
AS
|
|
BEGIN
|
|
SELECT distinct oenr as keyvalue, Bezeichnung
|
|
from dbo.oe
|
|
order by bezeichnung
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_rfcboard] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rptparams_get_rfcboard]
|
|
AS
|
|
BEGIN
|
|
SELECT TOP 100 PERCENT dbo.GremiumBereich.GremiumBereichnr AS keyvalue, dbo.GremiumBereich.Bereich AS bezeichnung
|
|
FROM dbo.Gremium INNER JOIN
|
|
dbo.GremiumGruppierung ON dbo.Gremium.GremiumNr = dbo.GremiumGruppierung.GremiumNr INNER JOIN
|
|
dbo.GremiumBereich ON dbo.GremiumGruppierung.GremiumGruppierungNr = dbo.GremiumBereich.GremiumGruppierungNr
|
|
WHERE (dbo.GremiumBereich.Aktiv = 1 and dbo.gremium.gremiumnr=1)
|
|
ORDER BY dbo.GremiumBereich.Bereich
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_rollen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rptparams_get_rollen]
|
|
as
|
|
select rollenr as keyvalue, bezeichnung from rolle where aktiv=1 order by bezeichnung
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_Server] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rptparams_get_Server]
|
|
AS
|
|
BEGIN
|
|
SELECT distinct 0 as keyvalue, dbo.ApplikationArchitekturObjectVirt.Applikation as bezeichnung
|
|
from dbo.ApplikationArchitekturObjectVirt
|
|
order by bezeichnung
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_sst] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
Create PROCEDURE [dbo].[sp_rptparams_get_sst]
|
|
AS
|
|
BEGIN
|
|
SELECT distinct 0 as keyvalue, dbo.ApplikationArchitekturObjectsst.sst as bezeichnung
|
|
from dbo.ApplikationArchitekturObjectsst
|
|
order by bezeichnung
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_team] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_rptparams_get_team]
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
select gremiumbereichnr as keyvalue, bereich as bezeichnung from dbo.GremiumBereich where gremiumgruppierungnr = 3 and aktiv = 1 order by bereich
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_rptparams_get_Verantwortung] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_rptparams_get_Verantwortung]
|
|
AS
|
|
BEGIN
|
|
SELECT GremiumGruppierungNr AS keyvalue, Gruppierungsbegriff AS bezeichnung
|
|
FROM dbo.GremiumGruppierung
|
|
WHERE (GremiumNr = 3) and dbo.gremiumgruppierung.aktiv=1
|
|
ORDER BY dbo.GremiumGruppierung.Gruppierungsbegriff
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_search_split] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
create proc [dbo].[sp_search_split] (
|
|
@sInputList varchar(8000) -- List of delimited items
|
|
, @Delimiter char(1) = ',' -- delimiter that separates items
|
|
)
|
|
AS BEGIN
|
|
SET NOCOUNT ON
|
|
DECLARE @Item Varchar(8000)
|
|
WHILE CHARINDEX(@Delimiter,@sInputList,0) <> 0
|
|
BEGIN
|
|
SELECT
|
|
@Item=RTRIM(LTRIM(SUBSTRING(@sInputList,1,CHARINDEX(@Delimiter,@sInputList,0)-1))),
|
|
@sInputList=RTRIM(LTRIM(SUBSTRING(@sInputList,CHARINDEX(@Delimiter,@sInputList,0)+1,LEN(@sInputList))))
|
|
IF LEN(@Item) > 0
|
|
INSERT INTO #tmpdeli SELECT @Item
|
|
END
|
|
IF LEN(@sInputList) > 0 INSERT INTO #tmpdeli SELECT @sInputList -- Put the last item in
|
|
RETURN
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_ServerInventar] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_ServerInventar] @fnkt INT = 0
|
|
AS
|
|
BEGIN
|
|
DECLARE @tbl TABLE
|
|
(
|
|
Mainkey INTEGER ,
|
|
Parentid INTEGER ,
|
|
bezeichnung VARCHAR(255) ,
|
|
imageindex INTEGER ,
|
|
aktiv INTEGER
|
|
)
|
|
|
|
|
|
--Root
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
aktiv
|
|
)
|
|
VALUES ( 0 ,
|
|
NULL ,
|
|
'Root' ,
|
|
1 ,
|
|
1
|
|
)
|
|
|
|
--Umgebung
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
aktiv
|
|
)
|
|
SELECT DISTINCT
|
|
dbo.Server_Umgebung.Server_UmgebungNr * 100000 AS MainKey ,
|
|
0 AS Parentid ,
|
|
dbo.Server_Umgebung.Bezeichnung ,
|
|
0 AS ImageIndex ,
|
|
1
|
|
FROM dbo.Server_Inventar
|
|
INNER JOIN dbo.Server_Umgebung ON dbo.Server_Inventar.Server_UmgebungNr = dbo.Server_Umgebung.Server_UmgebungNr
|
|
--WHERE server_inventar.Aktiv=1
|
|
ORDER BY MainKey
|
|
|
|
|
|
-- Server-Kategorie
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
aktiv
|
|
)
|
|
SELECT DISTINCT
|
|
dbo.Server_Kategorie.Server_KategorieNr * 110000
|
|
+ dbo.Server_Inventar.Server_UmgebungNr AS MainKey ,
|
|
dbo.Server_Inventar.Server_UmgebungNr * 100000 AS ParentID ,
|
|
dbo.Server_Kategorie.Bezeichnung ,
|
|
1 AS ImageIndex ,
|
|
1
|
|
FROM dbo.Server_Inventar
|
|
INNER JOIN dbo.Server_Kategorie ON dbo.Server_Inventar.Server_KategorieNr = dbo.Server_Kategorie.Server_KategorieNr
|
|
--WHERE server_inventar.aktiv=1
|
|
|
|
|
|
|
|
IF @fnkt = 0
|
|
BEGIN
|
|
|
|
-- Server
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
aktiv
|
|
)
|
|
SELECT DISTINCT
|
|
ServerInventarNr AS MainKey ,
|
|
Server_KategorieNr * 110000
|
|
+ Server_UmgebungNr AS ParentID ,
|
|
Bezeichnung ,
|
|
2 AS ImageIndex ,
|
|
AKTIV
|
|
FROM dbo.Server_Inventar
|
|
WHERE ( Aktiv = 1 )
|
|
ORDER BY Bezeichnung
|
|
END
|
|
|
|
IF @fnkt = 1
|
|
BEGIN
|
|
|
|
-- Server
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
aktiv
|
|
)
|
|
SELECT DISTINCT
|
|
ServerInventarNr AS MainKey ,
|
|
Server_KategorieNr * 110000
|
|
+ Server_UmgebungNr AS ParentID ,
|
|
Bezeichnung ,
|
|
2 AS ImageIndex ,
|
|
AKTIV
|
|
FROM dbo.Server_Inventar
|
|
WHERE ( Aktiv = 0 )
|
|
ORDER BY Bezeichnung
|
|
END
|
|
|
|
IF @fnkt =2
|
|
BEGIN
|
|
|
|
-- Server
|
|
INSERT @tbl
|
|
( Mainkey ,
|
|
Parentid ,
|
|
bezeichnung ,
|
|
imageindex ,
|
|
aktiv
|
|
)
|
|
SELECT DISTINCT
|
|
ServerInventarNr AS MainKey ,
|
|
Server_KategorieNr * 110000
|
|
+ Server_UmgebungNr AS ParentID ,
|
|
Bezeichnung ,
|
|
2 AS ImageIndex ,
|
|
AKTIV
|
|
FROM dbo.Server_Inventar
|
|
|
|
ORDER BY Bezeichnung
|
|
END
|
|
|
|
UPDATE @tbl
|
|
SET imageindex = 4
|
|
WHERE aktiv = 0
|
|
SELECT *
|
|
FROM @tbl
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_ServerInventar_sik] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_ServerInventar_sik]
|
|
@fnkt INT=0
|
|
AS
|
|
BEGIN
|
|
DECLARE @tbl TABLE(
|
|
Mainkey INTEGER,
|
|
Parentid INTEGER,
|
|
bezeichnung VARCHAR(255),
|
|
imageindex integer)
|
|
|
|
--Root
|
|
INSERT @tbl ( Mainkey, Parentid, bezeichnung, imageindex ) VALUES ( 0,NULL, 'Root',1)
|
|
|
|
--Umgebung
|
|
INSERT @tbl ( Mainkey, Parentid, bezeichnung, imageindex )
|
|
SELECT DISTINCT dbo.Server_Umgebung.Server_UmgebungNr*100000 AS MainKey, 0 AS Parentid, dbo.Server_Umgebung.Bezeichnung, 0 AS ImageIndex
|
|
FROM dbo.Server_Inventar INNER JOIN
|
|
dbo.Server_Umgebung ON dbo.Server_Inventar.Server_UmgebungNr = dbo.Server_Umgebung.Server_UmgebungNr WHERE server_inventar.Aktiv=1 ORDER BY MainKey
|
|
|
|
|
|
-- Server-Kategorie
|
|
INSERT @tbl ( Mainkey, Parentid, bezeichnung, imageindex )
|
|
SELECT DISTINCT
|
|
dbo.Server_Kategorie.Server_KategorieNr * 110000 + dbo.Server_Inventar.Server_UmgebungNr AS MainKey, dbo.Server_Inventar.Server_UmgebungNr * 100000 AS ParentID, dbo.Server_Kategorie.Bezeichnung,
|
|
1 AS ImageIndex
|
|
FROM dbo.Server_Inventar INNER JOIN
|
|
dbo.Server_Kategorie ON dbo.Server_Inventar.Server_KategorieNr = dbo.Server_Kategorie.Server_KategorieNr
|
|
WHERE server_inventar.aktiv=1
|
|
|
|
-- Server
|
|
INSERT @tbl ( Mainkey, Parentid, bezeichnung, imageindex )
|
|
SELECT DISTINCT ServerInventarNr AS MainKey, Server_KategorieNr * 110000 + Server_UmgebungNr AS ParentID, Bezeichnung, 2 AS ImageIndex
|
|
FROM dbo.Server_Inventar
|
|
WHERE (Aktiv = 1)
|
|
ORDER BY Bezeichnung
|
|
|
|
--IF @fnkt=0 BEGIN -- Nach Umgebung
|
|
-- INSERT @tbl(Mainkey,parentid,bezeichnung,imageindex) SELECT Server_Umgebungnr*100000,0,server_umgebung.Bezeichnung,1 FROM dbo.Server_Umgebung WHERE aktiv=1
|
|
-- INSERT @tbl(mainkey,Parentid,bezeichnung,imageindex) SELECT dbo.Server_Inventar.ServerInventarNr,dbo.Server_Inventar.Server_UmgebungNr*10000,bezeichnung,1 FROM dbo.Server_Inventar
|
|
-- END
|
|
--UPDATE @tbl SET imageindex=0 WHERE mainkey > 9999
|
|
SELECT * FROM @tbl
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_sysobjects_select] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[sp_sysobjects_select] AS
|
|
select * from sysobjects where xtype='U' order by name
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_tooltips] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
CREATE PROCEDURE [dbo].[sp_tooltips]
|
|
@fnkt int,
|
|
@formname varchar(50),
|
|
@controlname varchar(50),
|
|
@tooltip varchar(1024),
|
|
@mitarbeiternr int,
|
|
@outToolTipNr int output,
|
|
@outFormName varchar(50) output,
|
|
@outControlname varchar(50) output,
|
|
@outToolTip varchar(1024) output
|
|
AS
|
|
BEGIN
|
|
|
|
if @fnkt=1 begin
|
|
select @outtooltipnr=isnull(tooltipnr,0), @outformname=isnull(formularname,''), @outcontrolname=isnull(controlname,''), @outtooltip=isnull(tooltip,'')
|
|
from dbo.tooltip
|
|
where formularname=@formname and controlname=@controlname and aktiv=1
|
|
end
|
|
if @fnkt=2 begin
|
|
declare @tnr int
|
|
declare @dbkey int
|
|
|
|
declare @ierrorcode int
|
|
select @tnr=isnull(tooltipnr,-1)
|
|
from dbo.tooltip
|
|
where formularname=@formname and controlname=@controlname and aktiv=1
|
|
if @@rowcount=0 set @tnr=-1
|
|
if @tnr=-1 begin
|
|
execute sp_get_dbkey 'tooltip', @dbkey output, @ierrorcode output
|
|
insert dbo.tooltip(tooltipnr, formularname, controlname, tooltip, aktiv, erstellt_am, mutiert_am, mutierer)
|
|
values(@dbkey,@formname,@controlname,@tooltip,1,getdate(),getdate(),@mitarbeiternr)
|
|
end else begin
|
|
update dbo.tooltip set tooltip=@tooltip, mutierer=@mitarbeiternr, mutiert_am=getdate() where tooltipnr=@tnr
|
|
end
|
|
end
|
|
|
|
END
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_update_CheckedListBoxData] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Author,Stefan Hutter>
|
|
-- Create date: <Create Date, 12.01.2009 >
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_update_CheckedListBoxData]
|
|
@mitarbeiternr int,
|
|
@key int,
|
|
@applikationsnr int,
|
|
@typ int,
|
|
@Checked int
|
|
as
|
|
SET NOCOUNT ON;
|
|
|
|
-- Installationstyp/Installationauf
|
|
if @typ=1 begin
|
|
if @checked=0 begin
|
|
delete from applikationinstallationtyp
|
|
where applikationnr=@applikationsnr and installationtypnr=@key
|
|
end
|
|
if @checked=1 begin
|
|
select ApplikationInstallationNr from applikationinstallationtyp
|
|
where applikationnr=@applikationsnr and installationtypnr=@key
|
|
if @@rowcount = 0 begin
|
|
insert applikationinstallationtyp(applikationnr, installationtypnr, aktiv, erstellt_am, mutiert_am, mutierer)
|
|
values (@applikationsnr, @key, 1,getdate(), getdate(),@mitarbeiternr)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Installationals
|
|
if @typ=2 begin
|
|
if @checked=0 begin
|
|
delete from applikationinstallationals
|
|
where applikationnr=@applikationsnr and installationalstypnr=@key
|
|
end
|
|
if @checked=1 begin
|
|
select ApplikationInstallationAlsTypNr from applikationinstallationals
|
|
where applikationnr=@applikationsnr and installationalstypnr=@key
|
|
if @@rowcount = 0 begin
|
|
insert applikationinstallationals(applikationnr, installationalstypnr, aktiv, erstellt_am, mutiert_am, mutierer)
|
|
values (@applikationsnr, @key, 1,getdate(), getdate(),@mitarbeiternr)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- StandardFuer
|
|
if @typ=3 begin
|
|
if @checked=0 begin
|
|
delete from applikationinstallationfuer
|
|
where applikationnr=@applikationsnr and ApplikationStandardTypNr=@key
|
|
end
|
|
if @checked=1 begin
|
|
select ApplikationInstallationfuerNr from applikationinstallationfuer
|
|
where applikationnr=@applikationsnr and ApplikationStandardTypNr=@key
|
|
if @@rowcount = 0 begin
|
|
insert applikationinstallationfuer(applikationnr, ApplikationStandardTypNr, aktiv, erstellt_am, mutiert_am, mutierer)
|
|
values (@applikationsnr, @key, 1,getdate(), getdate(),@mitarbeiternr)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Applikation_ApplikationAbhaengigkeit
|
|
if @typ=4 begin
|
|
if @checked=0 begin
|
|
delete from applikationapplikationabhaengigkeit
|
|
where applikationnr=@applikationsnr and ApplikationAbhaengigkeitTyp=@key
|
|
end
|
|
if @checked=1 begin
|
|
select ApplikationApplikationAbhaengigkeit from ApplikationApplikationAbhaengigkeit
|
|
where applikationnr=@applikationsnr and ApplikationAbhaengigkeitTyp=@key
|
|
if @@rowcount = 0 begin
|
|
insert applikationapplikationabhaengigkeit(applikationnr, ApplikationAbhaengigkeitTyp, aktiv, erstellt_am, mutiert_am, mutierer)
|
|
values (@applikationsnr, @key, 1,getdate(), getdate(),@mitarbeiternr)
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_update_spalten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE PROCEDURE [dbo].[sp_update_spalten]
|
|
@tablename varchar(255)
|
|
AS
|
|
begin
|
|
declare @len int
|
|
declare @inhalt varchar(30)
|
|
declare @col varchar(30)
|
|
declare @readonly int
|
|
declare @dbkey int
|
|
declare @alshacken int
|
|
declare @ierrorcode int
|
|
declare @spaltenkey int
|
|
declare @aktiv int
|
|
declare @tiptext varchar(255)
|
|
declare xcursor cursor for
|
|
SELECT column_name
|
|
from INFORMATION_SCHEMA.Columns
|
|
where table_name = @tablename
|
|
open xcursor
|
|
FETCH NEXT FROM xcursor into @col
|
|
WHILE @@FETCH_STATUS = 0 BEGIN
|
|
execute sp_get_dbkey 'spalten', @dbkey output, @ierrorcode output
|
|
set @spaltenkey=@dbkey
|
|
|
|
set @inhalt=@col
|
|
set @readonly=0
|
|
set @aktiv=1
|
|
set @tiptext=''
|
|
set @len=100
|
|
set @alshacken=0
|
|
if upper(@col)='ERSTELLT_AM' begin
|
|
set @inhalt='Erstellungsdatum'
|
|
set @len=100
|
|
set @readonly=1
|
|
end
|
|
if upper(@col)='MUTIERT_AM' begin
|
|
set @inhalt='Mutationsdatum'
|
|
set @len=100
|
|
set @readonly=1
|
|
end
|
|
if upper(@col)='MUTIERER' begin
|
|
set @inhalt='Mutiert durch'
|
|
set @len=40
|
|
set @readonly=1
|
|
end
|
|
if upper(@col)='AKTIV' begin
|
|
set @inhalt='Aktiv'
|
|
set @len=40
|
|
set @alshacken=0
|
|
end
|
|
|
|
insert into spalten (eintragnr,tabelle,tabellenspalte,spalte,readonly,aktiv,erstellt_am, mutiert_am,mutierer,mandantnr,alsHacken,tiptext, breite, reihenfolge)
|
|
values(@spaltenkey,@tablename,@col,@inhalt,@readonly,@aktiv,getdate(),getdate(),-1,1,@alshacken,@tiptext,@len,0)
|
|
FETCH NEXT FROM xcursor into @col
|
|
end
|
|
close xcursor
|
|
deallocate xcursor
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_check_parent_child] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
Create PROCEDURE [dbo].[sp_vertragselement_check_parent_child]
|
|
@vertragselementnr int,
|
|
@anzahl int output
|
|
AS
|
|
BEGIN
|
|
select @anzahl = parentid from Vertragselement where Vertragselementnr=@vertragselementnr
|
|
if @anzahl > 0 return
|
|
|
|
|
|
select @anzahl=COUNT(*) from Vertragselement where ParentID=@Vertragselementnr
|
|
return
|
|
END
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_checkdaten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_vertragselement_checkdaten]
|
|
@vertragselementnr int,
|
|
@datum datetime,
|
|
@element varchar(255),
|
|
@parentid int
|
|
AS
|
|
BEGIN
|
|
select 0 as vertragselementnr, CONVERT(varchar(255),'') as Vertragselement, CONVERT(varchar(255),'') as Beschreibung into #tmpd
|
|
SET NOCOUNT ON;
|
|
-- declare @parentid int
|
|
-- select @parentid=ParentID from Vertragselement where Vertragselementnr=@vertragselementnr
|
|
|
|
if @element='dtPickerVertragsbegin' or @element='txtVertragsbegin' begin
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Übergeordnetes Element mit anderem Vertragsbegin (' + CONVERT(varchar(25),vertragsbeginn,104) +')'
|
|
From Vertragselement
|
|
where vertragselementnr = @parentid and Aktiv=1 and Vertragsbeginn<>@datum and Vertragselementnr<>@vertragselementnr
|
|
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Untergeordnetes Element mit anderem Vertragsbegin ('+ CONVERT(varchar(25),vertragsbeginn,104) +')'
|
|
from vertragselement
|
|
where aktiv=1 and parentid = @vertragselementnr and vertragsbeginn<>@datum and Vertragselementnr<>@vertragselementnr
|
|
|
|
insert #tmpd
|
|
select ereignisnr, bezeichnung,'Vertragsereignis Datum < Vertragsbegin ('+ CONVERT(varchar(25),datum,104) +')'
|
|
from vertragsereignis
|
|
where Vertragselementnr=@vertragselementnr and aktiv = 1 and datum < @datum and PeriodizitaetNr = 15
|
|
and @datum > '01.01.1900'
|
|
|
|
insert #tmpd
|
|
select ereignisnr, bezeichnung,'Vertragsereignis Start < Vertragsbegin ('+ CONVERT(varchar(25),start,104) +')'
|
|
from vertragsereignis
|
|
where Vertragselementnr=@vertragselementnr and aktiv = 1 and Start < @datum and PeriodizitaetNr <> 15
|
|
and @datum > '01.01.1900'
|
|
end
|
|
|
|
if @element='dtPickerVertragsende' or @element='txtVertragsende' begin
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Übergeordnetes Element mit anderem Vertragsende (' + CONVERT(varchar(25),vertragsablauf,104) +')'
|
|
From Vertragselement
|
|
where vertragselementnr = @parentid and Aktiv=1 and Vertragsablauf<>@datum
|
|
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Untergeordnetes Element mit anderem Vertragsende ('+ CONVERT(varchar(25),vertragsablauf,104) +')'
|
|
from vertragselement
|
|
where aktiv=1 and parentid = @vertragselementnr and Vertragsablauf<>@datum and Vertragselementnr<>@vertragselementnr
|
|
|
|
insert #tmpd
|
|
select ereignisnr, bezeichnung,'Vertragsereignis Datum > Vertragsende ('+ CONVERT(varchar(25),datum,104) +')'
|
|
from vertragsereignis
|
|
where Vertragselementnr=@vertragselementnr and aktiv = 1 and datum > @datum and PeriodizitaetNr = 15
|
|
and @datum > '01.01.1900'
|
|
insert #tmpd
|
|
select ereignisnr, bezeichnung,'Vertragsereignis Ende > Vertragsende ('+ CONVERT(varchar(25),start,104) +')'
|
|
from vertragsereignis
|
|
where Vertragselementnr=@vertragselementnr and aktiv = 1 and ende > @datum and PeriodizitaetNr <> 15
|
|
and @datum > '01.01.1900'
|
|
end
|
|
|
|
if @element='dtPickerGekuendigtam' or @element='txtGekuendigtam' begin
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Übergeordnetes Element mit anderem Gekündigt-Am-Datum (' + CONVERT(varchar(25),Gekuendigt_am,104) +')'
|
|
From Vertragselement
|
|
where vertragselementnr = @parentid and Aktiv=1 and Gekuendigt_am<>@datum
|
|
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Untergeordnetes Element mit anderem Gekündigt-Am-Datum ('+ CONVERT(varchar(25),Gekuendigt_am,104) +')'
|
|
from vertragselement
|
|
where aktiv=1 and parentid = @vertragselementnr and Gekuendigt_am<>@datum and Vertragselementnr<>@vertragselementnr
|
|
end
|
|
|
|
if @element='dtPickerGekuendigtper' or @element='txtGekuendigtper' begin
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Übergeordnetes Element mit anderem Gekündigt-Per-Datum (' + CONVERT(varchar(25),Gekuendigt_per,104) +')'
|
|
From Vertragselement
|
|
where vertragselementnr = @parentid and Aktiv=1 and Gekuendigt_per<>@datum and Vertragselementnr<>@vertragselementnr
|
|
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung, 'Untergeordnetes Element mit anderem Gekündigt-Per-Datum ('+ CONVERT(varchar(25),Gekuendigt_per,104) +')'
|
|
from vertragselement
|
|
where aktiv=1 and parentid = @vertragselementnr and Gekuendigt_per<>@datum and Vertragselementnr<>@vertragselementnr
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE FROM #TMPD WHERE VERTRAGSELEMENTNR=0
|
|
|
|
|
|
select * from #tmpd
|
|
drop table #tmpd
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_delete_childs] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
Create proc [dbo].[sp_vertragselement_delete_childs]
|
|
@vertragselementnr int,
|
|
@mitarbeiternr int
|
|
as
|
|
set nocount on
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null,
|
|
[vertragselementnrursprung] [int] null,
|
|
[basevertragstypnr] [int] null,
|
|
[key] [int] IDENTITY(1,1) NOT NULL,
|
|
[level] int null,
|
|
[loopcnt] int null,
|
|
|
|
) ON [PRIMARY]
|
|
|
|
|
|
declare @vnr int
|
|
declare @vtype varchar(255)
|
|
declare @tmpid int
|
|
declare @tmpid_base int
|
|
declare @aktiv bit
|
|
declare @tmp int
|
|
declare @loop int
|
|
declare @keyvalue int
|
|
declare @keyvalue1 int
|
|
declare @key int
|
|
declare @loopcnt int
|
|
|
|
set @tmpid=-100
|
|
set @loopcnt = 0
|
|
|
|
|
|
declare xy cursor for
|
|
select Vertragselementnr, parentid, vertragstypnr from vertragselement
|
|
where parentid=@vertragselementnr and aktiv = 1
|
|
and vertragselementnr not in (select vertragselementnr from #tmpd)
|
|
open xy
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, @vnr, @tmpid, @loopcnt
|
|
set @loopcnt=@loopcnt+1
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
end
|
|
close xy
|
|
deallocate xy
|
|
|
|
update Vertragselement set Aktiv=0, Mutiert_am=GETDATE(),Mutierer=@mitarbeiternr where Vertragselementnr in (select vertragselementnr from #tmpd)
|
|
update vertragsereignis set aktiv=0, mutiert_am = getdate(), mutierer=@mitarbeiternr where vertragselementnr in (select vertragselementnr from #tmpd)
|
|
select * from #tmpd
|
|
drop table #tmpd
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_delete_vertragselement_beziehungen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_vertragselement_delete_vertragselement_beziehungen]
|
|
@vertragselementnr int,
|
|
@mutierer int
|
|
AS
|
|
BEGIN
|
|
|
|
declare @vaenr int
|
|
declare @liz int
|
|
declare xc cursor for select vertragselementapplikationnr from vertragselementapplikation where vertragselementnr=@vertragselementnr and aktiv=1
|
|
open xc
|
|
fetch next from xc into @vaenr
|
|
while @@FETCH_STATUS=0 begin
|
|
declare lc cursor for select lizenzkaufnr from lizenzkauf where vertragselementapplikationnr=@vaenr and aktiv=1
|
|
open lc
|
|
fetch next from lc into @liz
|
|
while @@FETCH_STATUS=0 begin
|
|
update Lizenzschluessel set Aktiv=0, Mutierer=@mutierer,Mutiert_am=GETDATE() where Aktiv=1 and Lizenzkaufnr=@liz
|
|
update Lizenzkauf set Aktiv=0,Mutierer=@mutierer,Mutiert_am=GETdate() where LizenzkaufNr=@liz and Aktiv=1
|
|
fetch next from lc into @liz
|
|
end
|
|
close lc
|
|
deallocate lc
|
|
update VertragselementApplikation set Aktiv=0, Mutierer=@mutierer,Mutiert_am=GETDATE() where VertragselementApplikationnr=@vaenr and Aktiv=1
|
|
fetch next from xc into @vaenr
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
declare @enr int
|
|
declare ec cursor for select ereignisnr from vertragsereignis where vertragselementnr=@vertragselementnr and aktiv=1
|
|
open ec
|
|
fetch next from ec into @enr
|
|
while @@FETCH_STATUS=0 begin
|
|
update Aktivitaet set Aktiv=0, Mutiert_am=GETDATE(), Mutierer=@mutierer where Aktivitaet.Ereignisnr=@enr and Aktiv=1
|
|
fetch next from ec into @enr
|
|
end
|
|
close ec
|
|
deallocate ec
|
|
|
|
update dbo.vertragskontakt set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where vertragselementnr=@vertragselementnr and aktiv=1
|
|
update dbo.vertragselement_referenz set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where vertragselementnr_1=@vertragselementnr and aktiv=1
|
|
update dbo.vertragselement_referenz set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where vertragselementnr_2=@vertragselementnr and aktiv=1
|
|
update dbo.vertragsereignis set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where vertragselementnr=@vertragselementnr and aktiv=1
|
|
update dbo.vertragsleistung set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where vertragselementnr=@vertragselementnr and aktiv=1
|
|
update dbo.dokument set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where keyvalue=@vertragselementnr and doktype=1 and aktiv=1
|
|
update dbo.kuendigungsfrist set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where vertragselementnr=@vertragselementnr and aktiv=1
|
|
-- update dbo.vertragselementapplikation set aktiv=0, mutiert_am=getdate(), mutierer=@mutierer where vertragselementnr=@vertragselementnr and aktiv=1
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_details_inaktivieren] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <20.01.2009>
|
|
-- Description: <Inaktivieren sämtlicher untergeordneten Beziehungselemente eines Vertragselementes>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_vertragselement_details_inaktivieren]
|
|
@vertragselementnr int,
|
|
@mutierer int
|
|
AS
|
|
|
|
declare @nr int
|
|
declare @mitarbeiternr int
|
|
|
|
set @nr=@vertragselementnr
|
|
set @mitarbeiternr=@mutierer
|
|
|
|
|
|
-- update dbo.lizenzkauf
|
|
-- set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
-- where dbo.lizenzkauf.vertragselementnr=@nr and dbo.lizenzkauf.aktiv=1
|
|
|
|
update dbo.kuendigungsfrist
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.kuendigungsfrist.vertragselementnr=@nr and dbo.kuendigungsfrist.aktiv=1
|
|
|
|
update dbo.vertragskontakt
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.vertragskontakt.vertragselementnr=@nr and dbo.vertragskontakt.aktiv=1
|
|
|
|
update dbo.dokument
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.dokument.keyvalue=@nr and dbo.dokument.doktype=1 and dbo.dokument.aktiv=1
|
|
|
|
update dbo.vertragsleistung
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.vertragsleistung.vertragselementnr=@nr and dbo.vertragsleistung.aktiv=1
|
|
|
|
update dbo.vertragsereignis
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.vertragsereignis.vertragselementnr=@nr and dbo.vertragsereignis.aktiv=1
|
|
|
|
update dbo.pendenz
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.pendenz.vertragselementnr=@nr and dbo.pendenz.aktiv=1
|
|
|
|
update dbo.vertragselement
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.vertragselement.parentid=@nr
|
|
|
|
update dbo.vertragselementapplikation
|
|
set mutierer=@mitarbeiternr, aktiv=0, mutiert_am=getdate()
|
|
where dbo.vertragselementapplikation.vertragselementnr=@nr
|
|
|
|
EXECUTE dbo.sp_Check_lizenzkauf @NR, 'Del',@mitarbeiternr,0
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_details_inaktivieren_get_childs] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
-- =============================================
|
|
-- Author: <Stefan Hutter>
|
|
-- Create date: <20.01.2009>
|
|
-- Description: <Inaktivieren sämtlicher untergeordneten Beziehungselemente eines Vertragselementes>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_vertragselement_details_inaktivieren_get_childs]
|
|
@vertragselementnr int,
|
|
@mutierer int
|
|
AS
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[aktiv] bit
|
|
) ON [DEFAULT]
|
|
|
|
insert #tmpd (vertragselementnr, aktiv) values(@vertragselementnr,1)
|
|
|
|
declare @nr int
|
|
declare @aktiv bit
|
|
|
|
declare xc cursor for
|
|
select vertragselementnr, aktiv from dbo.vertragselement where parentid=@vertragselementnr
|
|
open xc
|
|
fetch next from xc into @nr, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd (vertragselementnr, aktiv) values (@nr, @aktiv)
|
|
exec sp_vertragselement_details_inaktivieren_get_childs_down @nr, 1, 0,-1
|
|
fetch next from xc into @nr, @aktiv
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
|
|
|
|
declare secondc cursor for
|
|
select vertragselementnr, aktiv from #tmpd where aktiv=1
|
|
open secondc
|
|
fetch next from secondc into @nr, @aktiv
|
|
while @@fetch_status = 0 begin
|
|
|
|
if @aktiv=1 begin
|
|
execute sp_vertragselement_details_inaktivieren @nr, @mutierer
|
|
end
|
|
fetch next from secondc into @nr, @aktiv
|
|
end
|
|
close secondc
|
|
deallocate secondc
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_details_inaktivieren_get_childs_down] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragselement_details_inaktivieren_get_childs_down]
|
|
@Root int,
|
|
@imandant int,
|
|
@vnr int,
|
|
@tmpid int
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON
|
|
declare @vertragselementnr int, @bezeichnung varchar(50), @nr int, @parent int, @seclevel int, @aktiv bit
|
|
|
|
select @bezeichnung=bezeichnung, @nr=vertragselementnr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv
|
|
from vertragselement
|
|
where vertragselementnr=@root
|
|
|
|
if @tmpid<>-1 set @parent=@tmpid
|
|
insert into #tmpd (vertragselementnr, aktiv) values (@nr, @aktiv)
|
|
|
|
set @vertragselementnr=(select min (vertragselementnr) from vertragselement where parentid=@root)
|
|
|
|
while @vertragselementnr is not null begin
|
|
exec sp_vertragselement_details_inaktivieren_get_childs_down @vertragselementnr, 1, @vnr,-1
|
|
set @vertragselementnr=(select min (vertragselementnr) from dbo.vertragselement where parentid=@root and vertragselementnr>@vertragselementnr)
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_Vertragselement_get_alle_elemente] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_Vertragselement_get_alle_elemente]
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
SELECT *
|
|
from vertragselemente_vollstaendig
|
|
where
|
|
vertragselemente_vollstaendig.securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
order by Partner
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_get_childs] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_vertragselement_get_childs]
|
|
@vertragselementnr int,
|
|
@mitarbeiternr int,
|
|
@partnernr int
|
|
as
|
|
set nocount on
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null,
|
|
[vertragselementnrursprung] [int] null,
|
|
[basevertragstypnr] [int] null,
|
|
[key] [int] IDENTITY(1,1) NOT NULL,
|
|
[level] int null,
|
|
[loopcnt] int null,
|
|
|
|
) ON [PRIMARY]
|
|
|
|
if @partnernr<>0 begin
|
|
select vertragselementnr,bezeichnung from Vertragselement where VertragspartnerNr=@partnernr and Aktiv=1
|
|
return
|
|
end
|
|
|
|
declare @vnr int
|
|
declare @vtype varchar(255)
|
|
declare @tmpid int
|
|
declare @tmpid_base int
|
|
declare @aktiv bit
|
|
declare @tmp int
|
|
declare @loop int
|
|
declare @keyvalue int
|
|
declare @keyvalue1 int
|
|
declare @key int
|
|
declare @loopcnt int
|
|
|
|
set @tmpid=-100
|
|
set @loopcnt = 0
|
|
|
|
|
|
declare xy cursor for
|
|
select Vertragselementnr, parentid, vertragstypnr from vertragselement
|
|
where parentid=@vertragselementnr and aktiv = 1
|
|
and vertragselementnr not in (select vertragselementnr from #tmpd)
|
|
open xy
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, @vnr, @tmpid, @loopcnt
|
|
set @loopcnt=@loopcnt+1
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
end
|
|
close xy
|
|
deallocate xy
|
|
|
|
select * from #tmpd
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_get_childs_old] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_vertragselement_get_childs_old]
|
|
@vertragselementnr int,
|
|
@mitarbeiternr int,
|
|
@partnernr int
|
|
as
|
|
set nocount on
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null,
|
|
[vertragselementnrursprung] [int] null,
|
|
[basevertragstypnr] [int] null,
|
|
[key] [int] IDENTITY(1,1) NOT NULL,
|
|
[level] int null,
|
|
[loopcnt] int null,
|
|
|
|
) ON [PRIMARY]
|
|
|
|
if @partnernr<>0 begin
|
|
select vertragselementnr,bezeichnung from Vertragselement where VertragspartnerNr=@partnernr and Aktiv=1
|
|
return
|
|
end
|
|
|
|
declare @vnr int
|
|
declare @vtype varchar(255)
|
|
declare @tmpid int
|
|
declare @tmpid_base int
|
|
declare @aktiv bit
|
|
declare @tmp int
|
|
declare @loop int
|
|
declare @keyvalue int
|
|
declare @keyvalue1 int
|
|
declare @key int
|
|
declare @loopcnt int
|
|
|
|
set @tmpid=-100
|
|
set @loopcnt = 0
|
|
|
|
|
|
declare xy cursor for
|
|
select Vertragselementnr, parentid, vertragstypnr from vertragselement
|
|
where parentid=@vertragselementnr and aktiv = 1
|
|
and vertragselementnr not in (select vertragselementnr from #tmpd)
|
|
open xy
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, @vnr, @tmpid, @loopcnt
|
|
set @loopcnt=@loopcnt+1
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
end
|
|
close xy
|
|
deallocate xy
|
|
|
|
select * from #tmpd
|
|
drop table #tmpd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_Parent_Struktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragselement_Parent_Struktur]
|
|
@vertragspartnernr int,
|
|
@mitarbeiternr int
|
|
as
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[aktiv] [bit] null,
|
|
|
|
) ON [DEFAULT]
|
|
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, aktiv) values(0,'Root',null,1)
|
|
|
|
insert #tmpd select vertragselementnr, bezeichnung, parentid, aktiv from vertragselement
|
|
where vertragselement.vertragspartnernr=@vertragspartnernr
|
|
|
|
select * from #tmpd order by parentid, bezeichnung
|
|
drop table #tmpd
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragselement_search] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragselement_search] @query varchar(1000),
|
|
@fnkt int,
|
|
@mitarbeiternr int
|
|
as
|
|
SET NOCOUNT ON
|
|
|
|
declare
|
|
@SQLWhere varchar(4096),
|
|
@xsql varchar(4096)
|
|
set @sqlwhere = ''
|
|
|
|
-- Suche nach Vertragspartner.NameZ1
|
|
if @fnkt=0 begin
|
|
|
|
set @sqlwhere = ' vertragspartner.namez1 like ' + + char(39) + '%' + @query + '%' + char(39)
|
|
|
|
set @xsql='SELECT dbo.vertragselement.vertragselementnr, dbo.Vertragspartner.NameZ1 + ' + char(39) + ' ' + char(39) + ' + dbo.Vertragspartner.NameZ2 +' + char(39) + ', ' + char(39) + '+ dbo.Vertragspartner.Ort AS Vertragspartner, dbo.Vertragstyp.Vertragstyp, '
|
|
set @xsql=@xsql+' dbo.Vertragselement.Bezeichnung, dbo.Vertragselement.Version, dbo.Vertragselement.Versionsdatum, dbo.vertragselement.nummer '
|
|
set @xsql=@xsql+' FROM dbo.Vertragselement INNER JOIN dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN '
|
|
set @xsql=@xsql+' dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr '
|
|
set @xsql=@xsql+' where dbo.vertragselement.securitylevelnr<=dbo.get_securitylevel('+str(@mitarbeiternr)+') and ' + @sqlwhere + ' order by vertragselement.bezeichnung '
|
|
|
|
exec(@xsql)
|
|
return
|
|
end
|
|
|
|
-- Suche nach Vertragselement.Bezeichnung
|
|
if @fnkt=1 begin
|
|
set @sqlwhere = ' vertragselement.bezeichnung like ' + + char(39) + '%' + @query + '%' + char(39)
|
|
|
|
set @xsql='SELECT dbo.vertragselement.vertragselementnr, dbo.Vertragspartner.NameZ1 + ' + char(39) + ' ' + char(39) + ' + dbo.Vertragspartner.NameZ2 +' + char(39) + ', ' + char(39) + '+ dbo.Vertragspartner.Ort AS Vertragspartner, dbo.Vertragstyp.Vertragstyp, '
|
|
set @xsql=@xsql+' dbo.Vertragselement.Bezeichnung, dbo.Vertragselement.Version, dbo.Vertragselement.Versionsdatum, dbo.vertragselement.nummer '
|
|
set @xsql=@xsql+' FROM dbo.Vertragselement INNER JOIN dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN '
|
|
set @xsql=@xsql+' dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr '
|
|
set @xsql=@xsql+' where dbo.vertragselement.securitylevelnr<=dbo.get_securitylevel('+str(@mitarbeiternr)+') and ' + @sqlwhere + ' order by vertragselement.bezeichnung '
|
|
|
|
exec(@xsql)
|
|
return
|
|
end
|
|
|
|
-- Suche nach Vertragselement.Inhalt
|
|
if @fnkt=2 begin
|
|
set @sqlwhere = ' vertragselement.Beschreibung like ' + + char(39) + '%' + @query + '%' + char(39)
|
|
|
|
set @xsql='SELECT dbo.vertragselement.vertragselementnr, dbo.Vertragspartner.NameZ1 + ' + char(39) + ' ' + char(39) + ' + dbo.Vertragspartner.NameZ2 +' + char(39) + ', ' + char(39) + '+ dbo.Vertragspartner.Ort AS Vertragspartner, dbo.Vertragstyp.Vertragstyp, '
|
|
set @xsql=@xsql+' dbo.Vertragselement.Bezeichnung, dbo.Vertragselement.Version, dbo.Vertragselement.Versionsdatum '
|
|
set @xsql=@xsql+' FROM dbo.Vertragselement INNER JOIN dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN '
|
|
set @xsql=@xsql+' dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr '
|
|
set @xsql=@xsql+' where dbo.vertragselement.securitylevelnr<=dbo.get_securitylevel('+str(@mitarbeiternr)+') and ' + @sqlwhere + ' order by vertragselement.bezeichnung '
|
|
|
|
exec(@xsql)
|
|
return
|
|
end
|
|
-- Suche nach Vertragselement.Suchbegriffe
|
|
if @fnkt=3 begin
|
|
set @sqlwhere = ' vertragselement.suchbegriffe like ' + + char(39) + '%' + @query + '%' + char(39)
|
|
|
|
set @xsql='SELECT dbo.vertragselement.vertragselementnr, dbo.Vertragspartner.NameZ1 + ' + char(39) + ' ' + char(39) + ' + dbo.Vertragspartner.NameZ2 +' + char(39) + ', ' + char(39) + '+ dbo.Vertragspartner.Ort AS Vertragspartner, dbo.Vertragstyp.Vertragstyp, '
|
|
set @xsql=@xsql+' dbo.Vertragselement.Bezeichnung, dbo.Vertragselement.Version, dbo.Vertragselement.Versionsdatum '
|
|
set @xsql=@xsql+' FROM dbo.Vertragselement INNER JOIN dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN '
|
|
set @xsql=@xsql+' dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr '
|
|
set @xsql=@xsql+' where dbo.vertragselement.securitylevelnr<=dbo.get_securitylevel('+str(@mitarbeiternr)+') and ' + @sqlwhere + ' order by vertragselement.bezeichnung '
|
|
|
|
exec(@xsql)
|
|
return
|
|
end
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsereignis_checkdaten] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_vertragsereignis_checkdaten]
|
|
@vertragselementnr int,
|
|
@datum datetime,
|
|
@element varchar(255)
|
|
AS
|
|
BEGIN
|
|
select 0 as vertragselementnr, CONVERT(varchar(255),'') as Vertragselement, CONVERT(varchar(255),'') as Beschreibung into #tmpd
|
|
SET NOCOUNT ON;
|
|
declare @periode int
|
|
declare @vnr int
|
|
select @periode=periodizitaetnr, @vnr=vertragselementnr from Vertragsereignis where ereignisnr=@vertragselementnr
|
|
|
|
if @element='dtPickerDatum' or @element='txtDatum' begin
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung,'Datum < Vertragsbegin ('+ CONVERT(varchar(25),vertragsbeginn,104) +')' as beschreibung
|
|
from Vertragselement
|
|
where Vertragsbeginn > @datum and vertragselementnr=@vnr and @datum > '01.01.1900'
|
|
|
|
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung,'Datum > Vertragsende ('+ CONVERT(varchar(25),Vertragsablauf,104) +')' as beschreibung
|
|
from Vertragselement where Vertragsablauf < @datum and vertragselementnr=@vnr and @datum > '01.01.1900'
|
|
end
|
|
|
|
if @element='dtPickerStart' or @element='txtStart' begin
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung,'Start < Vertragsbegin ('+ CONVERT(varchar(25),vertragsbeginn,104) +')' as beschreibung
|
|
from Vertragselement where Vertragsbeginn > @datum and vertragselementnr=@vnr and @datum > '01.01.1900'
|
|
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung,'Start > Vertragsende ('+ CONVERT(varchar(25),vertragsablauf,104) +')' as beschreibung
|
|
from Vertragselement where Vertragsablauf < @datum and vertragselementnr=@vnr and @datum > '01.01.1900' and Vertragsablauf>'01.01.1900'
|
|
end
|
|
|
|
if @element='dtPickerEnde' or @element='txtEnde' begin
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung,'Ende < Vertragsbegin ('+ CONVERT(varchar(25),vertragsbeginn,104) +')' as beschreibung
|
|
from Vertragselement where Vertragsbeginn > @datum and vertragselementnr=@vnr and @datum > '01.01.1900'
|
|
|
|
insert #tmpd
|
|
select vertragselementnr, bezeichnung,'Ende > Vertragsende ('+ CONVERT(varchar(25),vertragsablauf,104) +')' as beschreibung
|
|
from Vertragselement where Vertragsablauf < @datum and vertragselementnr=@vnr and @datum > '01.01.1900' and Vertragsablauf>'01.01.1900'
|
|
end
|
|
DELETE FROM #TMPD WHERE VERTRAGSELEMENTNR=0
|
|
|
|
|
|
select * from #tmpd
|
|
drop table #tmpd
|
|
|
|
END
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragspartner_search] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragspartner_search] @query varchar(1000),
|
|
@fnkt int,
|
|
@mitarbeiternr int
|
|
as
|
|
SET NOCOUNT ON
|
|
|
|
declare
|
|
@wordspace int,
|
|
@Word varchar(50),
|
|
@SQLWhere varchar(4096),
|
|
@scol varchar(1048)
|
|
|
|
set @scol = 'Vertragspartnernr namez1 namez2 strasse postfach plz ort telefon telefax email internet bemerkung'
|
|
set @sqlwhere = ''
|
|
|
|
if @fnkt=0 begin
|
|
set @sqlwhere = ' namez1 like ' + + char(39) + '%' + @query + '%' + char(39)
|
|
exec('select * from vertragspartner where vertragspartner.securitylevelnr<=dbo.get_securitylevel('+ @mitarbeiternr +') and ' + @sqlwhere + ' order by namez1, namez2')
|
|
return
|
|
end
|
|
|
|
if @fnkt=1 begin
|
|
set @sqlwhere = ' ort like ' + + char(39) + '%' + @query + '%' + char(39)
|
|
exec('select * from vertragspartner where vertragspartner.securitylevelnr<=dbo.get_securitylevel('+ @mitarbeiternr + ') and ' + @sqlwhere + ' order by namez1, namez2')
|
|
return
|
|
end
|
|
|
|
if @fnkt=2 begin
|
|
exec('select * from vertragspartner where vertragspartner.securitylevelnr<=dbo.get_securitylevel('+ @mitarbeiternr + ') order by namez1, namez2')
|
|
return
|
|
end
|
|
|
|
|
|
set @query= REPLACE ( @query , char(39) , '"' )
|
|
create table #tmpdeli(item varchar(8000))
|
|
|
|
if CHARINDEX ( '"' , @query ) > 0
|
|
execute dbo.sp_search_split @query,'"'
|
|
else
|
|
execute dbo.sp_search_split @query,' '
|
|
|
|
print @query
|
|
|
|
if @fnkt=2 begin
|
|
declare xc cursor for select * from #tmpdeli
|
|
open xc
|
|
fetch next from xc into @query
|
|
while @@fetch_status=0 begin
|
|
set @query= REPLACE ( @query , '*' , '%' )
|
|
if len(@sqlwhere) > 0 set @sqlwhere=@sqlwhere + ' and '
|
|
set @sqlwhere = @sqlwhere + 'bkpar00 like ' + char(39) + '%' + @query + '%' + char(39)
|
|
fetch next from xc into @query
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
drop table #tmpdeli
|
|
print @sqlwhere
|
|
exec('Select * from vertragspartner where '+ @SQLWhere + ' order by namez1, namez2 ')
|
|
return
|
|
end
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_details] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_details] @Elementtyp varchar(255),
|
|
@EntryRoot int,
|
|
@Vertragspartnernr int,
|
|
@mitarbeiternr int,
|
|
@suchstring varchar(255)
|
|
as
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[vertragstypnr] [int],
|
|
[aktiv] [bit] null,
|
|
[vertragselementnrursprung] [int] null ,
|
|
[basevertragstypnr] [int] null,
|
|
[key] [int] IDENTITY(1,1) NOT NULL,
|
|
[level] int null,
|
|
[loopcnt] int null,
|
|
|
|
) ON [DEFAULT]
|
|
|
|
declare @tmp int
|
|
|
|
-- Alle untergeordneten Elemente eines Vertragselementes
|
|
if @Elementtyp = "Vertragselement" begin
|
|
declare xc cursor for
|
|
select Vertragselementnr from vertragselement
|
|
where
|
|
(vertragselementnr=@EntryRoot
|
|
and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(vertragselementnr, @suchstring)=1 )
|
|
-- 2009-06-26 - Erweiterung, dass auch das angewählte Element mit den Details angezeigt wird
|
|
or
|
|
vertragselementnr=@EntryRoot
|
|
|
|
open xc
|
|
fetch next from xc into @tmp
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, 0, 0,0
|
|
fetch next from xc into @tmp
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
end
|
|
|
|
if @Elementtyp="Vertragstyp" begin
|
|
-- Elemente eines ausgew„hlten Partner
|
|
if @Vertragspartnernr<>0 begin
|
|
declare xctyp cursor for
|
|
select Vertragselementnr from vertragselement
|
|
where vertragstypnr=@entryroot and vertragspartnernr=@vertragspartnernr
|
|
and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(vertragselementnr, @suchstring)=1
|
|
open xctyp
|
|
fetch next from xctyp into @tmp
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, 0, 0,0
|
|
fetch next from xctyp into @tmp
|
|
end
|
|
close xctyp
|
|
deallocate xctyp
|
|
end else begin
|
|
-- Elemente aller Partner
|
|
declare xctyp1 cursor for
|
|
select Vertragselementnr from vertragselement
|
|
where vertragstypnr=@entryroot
|
|
and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(vertragselementnr, @suchstring)=1
|
|
open xctyp1
|
|
fetch next from xctyp1 into @tmp
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, 0, 0,0
|
|
fetch next from xctyp1 into @tmp
|
|
end
|
|
close xctyp1
|
|
deallocate xctyp1
|
|
end
|
|
end
|
|
|
|
if @elementtyp="Vertragspartner" begin
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, vertragstypnr)
|
|
select Vertragselementnr, '',0,0 from
|
|
vertragselement
|
|
where dbo.vertragselement.vertragspartnernr=@vertragspartnernr
|
|
and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(vertragselementnr, @suchstring)=1
|
|
end
|
|
|
|
|
|
if @suchstring='' begin
|
|
SELECT distinct dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Partner,
|
|
dbo.Vertragstyp.Vertragstyp, dbo.view_vertragselement.*, dbo.view_vertragselement.Mutierer AS Expr1,
|
|
dbo.mitarbeiter.name + ' ' + dbo.mitarbeiter.vorname + ', ' + dbo.mitarbeiter.tgnummer AS Mutierername
|
|
FROM #tmpd INNER JOIN
|
|
dbo.view_vertragselement INNER JOIN
|
|
dbo.Vertragspartner ON dbo.view_vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.view_vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr ON
|
|
#tmpd.vertragselementnr = dbo.view_vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.mitarbeiter ON dbo.view_vertragselement.Mutierer = dbo.mitarbeiter.mitarbeiternr
|
|
--20091008 - nur berechtigte Objekte zurückgeben
|
|
and dbo.view_vertragselement.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
|
|
-- SELECT distinct dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Partner,
|
|
-- dbo.Vertragstyp.Vertragstyp, dbo.Vertragselement.*, dbo.Vertragselement.Mutierer AS Expr1,
|
|
-- dbo.mitarbeiter.name + ' ' + dbo.mitarbeiter.vorname + ', ' + dbo.mitarbeiter.tgnummer AS Mutierername
|
|
-- FROM #tmpd INNER JOIN
|
|
-- dbo.Vertragselement INNER JOIN
|
|
-- dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
-- dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr ON
|
|
-- #tmpd.vertragselementnr = dbo.Vertragselement.Vertragselementnr INNER JOIN
|
|
-- dbo.mitarbeiter ON dbo.Vertragselement.Mutierer = dbo.mitarbeiter.mitarbeiternr
|
|
end else begin
|
|
SELECT distinct dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Partner,
|
|
dbo.Vertragstyp.Vertragstyp, dbo.view_vertragselement.*, dbo.view_vertragselement.Mutierer AS Expr1,
|
|
dbo.mitarbeiter.name + ' ' + dbo.mitarbeiter.vorname + ', ' + dbo.mitarbeiter.tgnummer AS Mutierername
|
|
FROM #tmpd INNER JOIN
|
|
dbo.view_vertragselement INNER JOIN
|
|
dbo.Vertragspartner ON dbo.view_vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.view_vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr ON
|
|
#tmpd.vertragselementnr = dbo.view_vertragselement.Vertragselementnr INNER JOIN
|
|
dbo.mitarbeiter ON dbo.view_vertragselement.Mutierer = dbo.mitarbeiter.mitarbeiternr
|
|
where (dbo.search_vertragselement(dbo.view_vertragselement.vertragselementnr, @suchstring)=1
|
|
-- 2009-06-26 - Erweiterung, dass auch das angewählte Element mit den Details angezeigt wird
|
|
or dbo.view_vertragselement.vertragselementnr = @entryroot)
|
|
--20091008 - nur berechtigte Objekte zurückgeben
|
|
and dbo.view_vertragselement.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
end
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_lizenzen] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date,,>
|
|
-- Description: <Description,,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[sp_vertragsuebersicht_get_lizenzen]
|
|
@Vertragselementnr int,
|
|
@Applikationnr int,
|
|
@mitarbeiternr int
|
|
AS
|
|
BEGIN
|
|
if @Applikationnr=0 begin
|
|
|
|
SELECT DISTINCT
|
|
dbo.Lizenzkauf.LizenzkaufNr, dbo.Lizenzkauf.Vertragselementapplikationnr, dbo.Lizenztyp.Bezeichnung AS Lizenztypnr, dbo.Lizenzkauf.Anzahl,
|
|
dbo.Lizenzkauf.Kaufdatum, dbo.Lizenzkauf.KGNummer, dbo.Lizenzkauf.SAPNummer, dbo.Lizenzkauf.Gueltigbis, dbo.Lizenzkauf.Statusnr, dbo.Lizenzkauf.Bemerkung,
|
|
dbo.Lizenzkauf.Aktiv, dbo.Lizenzkauf.Erstellt_am, dbo.Lizenzkauf.Mutiert_am, dbo.Lizenzkauf.Mutierer, dbo.Lizenz.Lizenznr AS Lizenznr, dbo.Lizenz.Bezeichnung AS Lizenzelement
|
|
FROM dbo.LizenzVertragselementApplikation INNER JOIN
|
|
dbo.VertragselementApplikation ON
|
|
dbo.LizenzVertragselementApplikation.VertragselementApplikationNr = dbo.VertragselementApplikation.VertragselementApplikationnr INNER JOIN
|
|
dbo.Lizenz ON dbo.LizenzVertragselementApplikation.Lizenznr = dbo.Lizenz.LizenzNr INNER JOIN
|
|
dbo.Lizenzkauf INNER JOIN
|
|
dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr ON dbo.Lizenz.LizenzNr = dbo.Lizenzkauf.Lizenznr
|
|
WHERE (dbo.LizenzVertragselementApplikation.VertragselementApplikationNr = @Vertragselementnr)
|
|
end else begin
|
|
SELECT DISTINCT
|
|
dbo.Lizenzkauf.LizenzkaufNr, dbo.Lizenzkauf.Vertragselementapplikationnr, dbo.Lizenztyp.Bezeichnung AS Lizenztypnr, dbo.Lizenzkauf.Anzahl,
|
|
dbo.Lizenzkauf.Kaufdatum, dbo.Lizenzkauf.KGNummer, dbo.Lizenzkauf.SAPNummer, dbo.Lizenzkauf.Gueltigbis, dbo.Lizenzkauf.Statusnr, dbo.Lizenzkauf.Bemerkung,
|
|
dbo.Lizenzkauf.Aktiv, dbo.Lizenzkauf.Erstellt_am, dbo.Lizenzkauf.Mutiert_am, dbo.Lizenzkauf.Mutierer, dbo.Lizenz.LizenzNr AS Lizenznr, dbo.Lizenz.Bezeichnung AS Lizenzelement,
|
|
dbo.Lizenz.Bezeichnung AS Lizenzelement, dbo.VertragselementApplikation.Applikationnr
|
|
FROM dbo.LizenzVertragselementApplikation INNER JOIN
|
|
dbo.VertragselementApplikation ON
|
|
dbo.LizenzVertragselementApplikation.VertragselementApplikationNr = dbo.VertragselementApplikation.VertragselementApplikationnr INNER JOIN
|
|
dbo.Lizenz ON dbo.LizenzVertragselementApplikation.Lizenznr = dbo.Lizenz.LizenzNr INNER JOIN
|
|
dbo.Lizenzkauf INNER JOIN
|
|
dbo.Lizenztyp ON dbo.Lizenzkauf.Lizenztypnr = dbo.Lizenztyp.Lizenztypnr ON dbo.Lizenz.LizenzNr = dbo.Lizenzkauf.Lizenznr
|
|
WHERE (dbo.VertragselementApplikation.Applikationnr = @Applikationnr)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_struktur] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_struktur]
|
|
@vertragstypnr int,
|
|
@vertragspartnernr int,
|
|
@mitarbeiternr int,
|
|
@details int,
|
|
@suchstring varchar(255)
|
|
as
|
|
set nocount on
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null,
|
|
[vertragselementnrursprung] [int] null,
|
|
[basevertragstypnr] [int] null,
|
|
[key] [int] IDENTITY(1,1) NOT NULL,
|
|
[level] int null,
|
|
[loopcnt] int null,
|
|
|
|
) ON [DEFAULT]
|
|
|
|
CREATE TABLE #tmpe(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null,
|
|
[vertragselementnrursprung] [int] null,
|
|
[basevertragstypnr] [int] null,
|
|
[key] [int] NOT NULL,
|
|
[level] int null,
|
|
[loopcnt] int null,
|
|
|
|
) ON [DEFAULT]
|
|
|
|
CREATE TABLE #tmps(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null,
|
|
[vertragselementnrursprung] [int] null,
|
|
[basevertragstypnr] [int] null,
|
|
[key] [int] NOT NULL,
|
|
[level] int null,
|
|
[loopcnt] int null,
|
|
|
|
) ON [DEFAULT]
|
|
|
|
declare @vnr int
|
|
declare @vtype varchar(255)
|
|
declare @tmpid int
|
|
declare @tmpid_base int
|
|
declare @aktiv bit
|
|
declare @tmp int
|
|
declare @loop int
|
|
declare @keyvalue int
|
|
declare @keyvalue1 int
|
|
declare @key int
|
|
declare @loopcnt int
|
|
|
|
set @tmpid=-100
|
|
set @loopcnt = 0
|
|
----------------------------------------------------------------------------------------------------------
|
|
-- Struktur nach Partner auslesen / ohne Suchstring - Suchstring berücksichtigt Vertragsinhalt
|
|
----------------------------------------------------------------------------------------------------------
|
|
Struktur_Nach_Partner:
|
|
--if @suchstring<>'' goto suche_mit_searchstring
|
|
-- Vertragstypen mit Vertragselementen
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, vertragstypnr, aktiv) values(0,'Root',null,0,1)
|
|
set @loop=0
|
|
declare @rootvertragstypnr int, @rootvertragstyp varchar(255)
|
|
declare xc cursor for
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr*-100, dbo.Vertragstyp.Vertragstyp
|
|
FROM dbo.Vertragstyp INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragstyp.Vertragstypnr = dbo.Vertragselement.VertragstypNr
|
|
WHERE (dbo.Vertragselement.VertragspartnerNr = @vertragspartnernr) and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
ORDER BY dbo.Vertragstyp.Vertragstyp
|
|
open xc
|
|
fetch next from xc into @rootvertragstypnr, @rootvertragstyp
|
|
while @@fetch_status=0 begin
|
|
-- Vertragselemente mit parentid=0 mit entsprechendem Vertragstyp
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, vertragstypnr, aktiv) values(@rootvertragstypnr,@rootvertragstyp,0,@rootvertragstypnr,@aktiv)
|
|
|
|
declare xy cursor for
|
|
select Vertragselementnr, parentid, vertragstypnr from vertragselement
|
|
where vertragspartnernr=@vertragspartnernr and vertragstypnr*-100=@rootvertragstypnr and parentid=0 and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
open xy
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, @vnr, @tmpid, @loopcnt
|
|
set @loopcnt=@loopcnt+1
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
end
|
|
close xy
|
|
deallocate xy
|
|
-- Vertragselemente mit Parentid<>0
|
|
declare xy cursor for
|
|
select Vertragselementnr, parentid, vertragstypnr from vertragselement
|
|
where vertragspartnernr=@vertragspartnernr and vertragstypnr*-100=@rootvertragstypnr and parentid<>0 and securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and vertragselementnr not in (select vertragselementnr from #tmpd)
|
|
open xy
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, @vnr, @tmpid, @loopcnt
|
|
set @loopcnt=@loopcnt+1
|
|
fetch next from xy into @tmp, @tmpid, @vnr
|
|
end
|
|
close xy
|
|
deallocate xy
|
|
|
|
-- Eindeutige Schlüssel
|
|
if @loop>0 begin
|
|
--select * from #tmpd
|
|
set @keyvalue=(@loop*10000)+100000
|
|
set @keyvalue1 = @keyvalue
|
|
update #tmpd set vertragselementnr=vertragselementnr+@keyvalue where [vertragselementnrursprung]>0
|
|
update #tmpd set parentid=parentid+@keyvalue where [vertragselementnrursprung]>0
|
|
select top 1 @keyvalue=vertragselementnr, @key=[key] from #tmpd where [vertragselementnrursprung] is null
|
|
update #tmpd set parentid=@keyvalue where parentid not in (select vertragselementnr from #tmpd)
|
|
|
|
|
|
end
|
|
update #tmpd set basevertragstypnr=@rootvertragstypnr/-100
|
|
set @loop=@loop+1
|
|
update #tmpd set parentid=@rootvertragstypnr where parentid=0
|
|
insert #tmpe select * from #tmpd
|
|
delete from #tmpd
|
|
fetch next from xc into @rootvertragstypnr, @rootvertragstyp
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
update #tmpe set parentid=0 where parentid=vertragselementnr
|
|
update #tmpe set aktiv=1 where aktiv is null
|
|
-- update #tmpe set parentid=0 where parentid not in (select vertragselementnr from #tmpe)
|
|
update #tmpe set parentid=vertragstypnr where parentid not in (select vertragselementnr from #tmpe)
|
|
|
|
if @suchstring='' begin
|
|
select *, null as Securitylevelnr into #tmpxx from #tmpe order by [key]
|
|
update #tmpxx set securitylevelnr = (select securitylevelnr from dbo.vertragselement where dbo.vertragselement.vertragselementnr = #tmpxx.vertragselementnrursprung)
|
|
select * from #tmpxx where securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) or [level] is null order by [key]
|
|
|
|
-- -select * from #tmpe order by [key]
|
|
drop table #tmpd
|
|
drop table #tmpe
|
|
drop table #tmps
|
|
drop table #tmpxx
|
|
return
|
|
end
|
|
|
|
-------------------------------------------------------------------------------------------
|
|
-- Suche mit Searchstring
|
|
-------------------------------------------------------------------------------------------
|
|
Suche_Mit_Searchstring:
|
|
declare @level int
|
|
|
|
declare @pid int
|
|
|
|
declare @xx int
|
|
|
|
declare @xxpid int
|
|
|
|
declare @cnt int
|
|
|
|
declare @elementnr int
|
|
|
|
declare @xxelementnr int
|
|
|
|
|
|
|
|
declare @xkey int
|
|
|
|
declare @xlevel int
|
|
|
|
declare @xpid int
|
|
|
|
declare @ykey int
|
|
|
|
|
|
|
|
declare xc cursor for
|
|
|
|
select [key],basevertragstypnr,parentid, level, loopcnt, vertragselementnr from #tmpe where dbo.search_vertragselement([vertragselementnrursprung],@suchstring)=1
|
|
|
|
open xc
|
|
|
|
fetch next from xc into @tmp,@vnr,@pid, @level, @loopcnt, @elementnr
|
|
|
|
while @@fetch_status=0 begin
|
|
|
|
set @xpid=@pid
|
|
|
|
insert #tmps select * from #tmpe where [key]=@tmp
|
|
|
|
while @pid > 0 begin
|
|
|
|
select @tmp=[key], @pid=parentid from #tmpe where vertragselementnr=@pid
|
|
|
|
insert #tmps select * from #tmpe where [key]=@tmp
|
|
|
|
end
|
|
|
|
|
|
|
|
declare xx cursor for select [key], parentid, vertragselementnr
|
|
|
|
from #tmpe where loopcnt = @loopcnt and level>@level
|
|
|
|
open xx
|
|
|
|
fetch next from xx into @xx, @xxpid, @xxelementnr
|
|
|
|
while @@fetch_status = 0 begin
|
|
|
|
select @cnt=count([key]) from #tmpe where parentid in (select vertragselementnr from #tmpe)
|
|
|
|
if @cnt > 0 insert #tmps select * from #tmpe where [key]=@xx and @xxelementnr not in (select vertragselementnr from #tmps)
|
|
|
|
fetch next from xx into @xx, @xxpid, @xxelementnr
|
|
|
|
end
|
|
|
|
close xx
|
|
|
|
deallocate xx
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
-- insert #tmps select * from #tmpe where (basevertragstypnr=@vnr and [key]<=@tmp and parentid<>@pid) or ([key]=@tmp) and
|
|
|
|
-- @elementnr not in (select vertragselementnr from #tmps) and parentid > 0
|
|
|
|
-- order by [key]
|
|
|
|
insert #tmps select * from #tmpe where loopcnt=@loopcnt
|
|
|
|
--(basevertragstypnr=@vnr and [key]<=@tmp and parentid<>@pid) or ([key]=@tmp) and
|
|
|
|
declare xx cursor for select [key], parentid, vertragselementnr
|
|
|
|
from #tmpe where loopcnt = @loopcnt and level>@level
|
|
|
|
open xx
|
|
|
|
fetch next from xx into @xx, @xxpid, @xxelementnr
|
|
|
|
while @@fetch_status = 0 begin
|
|
|
|
select @cnt=count([key]) from #tmpe where parentid in (select vertragselementnr from #tmpe)
|
|
|
|
if @cnt > 0 insert #tmps select * from #tmpe where [key]=@xx and @xxelementnr not in (select vertragselementnr from #tmps)
|
|
|
|
fetch next from xx into @xx, @xxpid, @xxelementnr
|
|
|
|
end
|
|
|
|
close xx
|
|
|
|
deallocate xx
|
|
|
|
-- insert #tmps select * from #tmpe where loopcnt = @loopcnt and level > @level and parentid in (select vertragselementnr from #tmps)
|
|
|
|
fetch next from xc into @tmp,@vnr,@pid, @level, @loopcnt, @elementnr
|
|
|
|
end
|
|
|
|
|
|
|
|
*/
|
|
|
|
fetch next from xc into @tmp,@vnr,@pid, @level, @loopcnt, @elementnr
|
|
|
|
end
|
|
|
|
close xc
|
|
|
|
deallocate xc
|
|
|
|
|
|
|
|
insert #tmps select * from #tmpe where vertragselementnr in (select parentid from #tmps where parentid < 0)
|
|
|
|
select @cnt=count(*) from #tmps where bezeichnung='Root'
|
|
|
|
if @cnt<1 begin
|
|
|
|
insert #tmps (vertragselementnr, bezeichnung, parentid, vertragstypnr, aktiv,[key]) values(0,'Root',null,0,1,999999)
|
|
|
|
end
|
|
|
|
|
|
|
|
--alter table #tmps drop column [key]
|
|
|
|
--alter table #tmps drop column [LEVEL]
|
|
|
|
--alter table #tmps drop column [LOOPCNT]
|
|
|
|
|
|
|
|
|
|
|
|
-- select distinct * from #tmps order by [key]
|
|
select distinct *, null as Securitylevelnr into #tmpyy from #tmps order by [key]
|
|
update #tmpyy set securitylevelnr = (select securitylevelnr from dbo.vertragselement where dbo.vertragselement.vertragselementnr = #tmpyy.vertragselementnrursprung)
|
|
select * from #tmpyy where securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) or [level] is null order by [key]
|
|
|
|
|
|
drop table #tmpd
|
|
drop table #tmpe
|
|
drop table #tmps
|
|
drop table #tmpyy
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_struktur_down] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_struktur_down] @Root int,
|
|
@imandant int,
|
|
@vnr int,
|
|
@tmpid int,
|
|
@loopcnt int
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON
|
|
declare @vertragselementnr int, @bezeichnung varchar(255), @nr int, @parent int, @seclevel int, @aktiv bit
|
|
|
|
select @bezeichnung=bezeichnung, @nr=vertragselementnr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv, @vnr=vertragstypnr
|
|
from vertragselement
|
|
where vertragselementnr=@root
|
|
|
|
if @tmpid<>-1 set @parent=@tmpid
|
|
declare @cnt int
|
|
select @cnt=count(*) from #tmpd where vertragselementnr=@nr
|
|
if @cnt<1 insert into #tmpd (vertragselementnr, bezeichnung, parentid,vertragstypnr, aktiv,vertragselementnrursprung, level, loopcnt) values (@nr, @bezeichnung, @parent,@vnr*-100, @aktiv,@nr, @@nestlevel,@loopcnt)
|
|
--insert into #tmpd (vertragselementnr, bezeichnung, parentid,vertragstypnr, aktiv, vertragselementnrursprung) values (@nr, @bezeichnung, @parent,@vnr, @aktiv, @nr)
|
|
set @vertragselementnr=(select min (vertragselementnr) from vertragselement where parentid=@root)
|
|
|
|
while @vertragselementnr is not null begin
|
|
exec dbo.sp_vertragsuebersicht_get_struktur_down @vertragselementnr, 1, @vnr,-1, @loopcnt
|
|
set @vertragselementnr=(select min (vertragselementnr) from dbo.vertragselement where parentid=@root and vertragselementnr>@vertragselementnr)
|
|
end
|
|
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_struktur_up] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS OFF
|
|
GO
|
|
SET QUOTED_IDENTIFIER OFF
|
|
GO
|
|
|
|
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_struktur_up]
|
|
@Root int,
|
|
@imandant int,
|
|
@vnr int,
|
|
@tmpid int
|
|
|
|
AS
|
|
BEGIN
|
|
|
|
SET NOCOUNT ON
|
|
declare @vertragselementnr int, @bezeichnung varchar(255), @nr int, @parent int, @seclevel int, @aktiv bit, @vtnr int
|
|
|
|
select @bezeichnung=bezeichnung, @nr=vertragselementnr, @parent=parentid, @seclevel=securitylevelnr, @aktiv=aktiv, @vtnr=vertragstypnr
|
|
from vertragselement
|
|
where vertragselementnr=@root
|
|
declare @cnt int
|
|
if @parent = 0 set @parent=@tmpid
|
|
select @cnt=count(*) from #tmpd where vertragselementnr=@nr
|
|
if @cnt<1 insert into #tmpd (vertragselementnr, bezeichnung, parentid,vertragstypnr, aktiv,vertragselementnrursprung) values (@nr, @bezeichnung, @parent,@vnr*-100, @aktiv,@nr)
|
|
|
|
set @vertragselementnr=(select parentid from vertragselement where vertragselementnr=@nr)
|
|
while @vertragselementnr is not null and @vertragselementnr > 0 begin
|
|
exec dbo.sp_vertragsuebersicht_get_struktur_up @vertragselementnr, 1, @vnr, @tmpid
|
|
set @vertragselementnr=(select parentid from vertragselement where vertragselementnr=@nr and parentid>@vertragselementnr)
|
|
end
|
|
|
|
end
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_Struktur_Vertragstyp] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_Struktur_Vertragstyp]
|
|
@vertragstypnr int,
|
|
@mitarbeiternr int,
|
|
@details int,
|
|
@suchstring varchar(255)
|
|
as
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null
|
|
) ON [DEFAULT]
|
|
|
|
set @suchstring='%'+@suchstring+'%'
|
|
declare @vnr int
|
|
declare @vtype varchar(255)
|
|
declare @tmpid int
|
|
declare @tmpid_base int
|
|
declare @aktiv bit
|
|
set @tmpid=-100
|
|
|
|
----------------------------------------------------------------------------------------------------------
|
|
-- Struktur nach Vertragstyp
|
|
----------------------------------------------------------------------------------------------------------
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, vertragstypnr, aktiv) values(0,'Root',null,0,1)
|
|
-- S„mtliche relevanten Root-Strukturen auslesen - nur diejenigen, bei welchen Vertragselemente vorhanden sind und der User berechtigt ist
|
|
if substring(@suchstring,2,2)='V:' or @suchstring='' begin
|
|
set @suchstring='%'+substring(@suchstring,4,len(@suchstring)-3)
|
|
print @suchstring
|
|
declare firstloop cursor for
|
|
SELECT distinct dbo.Vertragselement.VertragspartnerNr,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Partner,
|
|
dbo.Vertragspartner.aktiv
|
|
--,dbo.Vertragselement.Vertragselementnr
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
WHERE (dbo.Vertragselement.Aktiv = 1) AND (dbo.Vertragselement.VertragstypNr = @vertragstypnr)
|
|
and (dbo.Vertragselement.SecurityLevelNr <= dbo.Get_SecurityLevel(@mitarbeiternr))
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or dbo.vertragspartner.ort like @suchstring)
|
|
|
|
open firstloop
|
|
fetch next from firstloop into @vnr, @vtype, @aktiv
|
|
while @@fetch_status=0 begin
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, vertragstypnr, aktiv) values(@tmpid,@vtype,0,@vnr, @aktiv)
|
|
set @tmpid=@tmpid-1
|
|
fetch next from firstloop into @vnr, @vtype, @aktiv
|
|
end
|
|
close firstloop
|
|
deallocate firstloop
|
|
if @details=0 begin
|
|
delete from #tmpd where parentid > 0
|
|
end
|
|
select distinct * from #tmpd order by bezeichnung
|
|
return
|
|
end
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_Struktur_Vertragstyp_sik] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_Struktur_Vertragstyp_sik]
|
|
@vertragstypnr int,
|
|
@mitarbeiternr int,
|
|
@details int,
|
|
@suchstring varchar(255)
|
|
as
|
|
|
|
CREATE TABLE #tmpd(
|
|
[vertragselementnr] [int] ,
|
|
[bezeichnung] [varchar] (255) null,
|
|
[parentid] [int] null,
|
|
[Vertragstypnr] [int],
|
|
[aktiv] [bit] null
|
|
) ON [DEFAULT]
|
|
|
|
set @suchstring='%'+@suchstring+'%'
|
|
declare @vnr int
|
|
declare @vtype varchar(255)
|
|
declare @tmpid int
|
|
declare @tmpid_base int
|
|
declare @aktiv bit
|
|
set @tmpid=-100
|
|
|
|
----------------------------------------------------------------------------------------------------------
|
|
-- Struktur nach Vertragstyp
|
|
----------------------------------------------------------------------------------------------------------
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, vertragstypnr, aktiv) values(0,'Root',null,0,1)
|
|
select * from #tmpd
|
|
-- S„mtliche relevanten Root-Strukturen auslesen - nur diejenigen, bei welchen Vertragselemente vorhanden sind und der User berechtigt ist
|
|
declare firstloop cursor for
|
|
SELECT distinct dbo.Vertragselement.VertragspartnerNr,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Partner,
|
|
dbo.Vertragspartner.aktiv
|
|
--,dbo.Vertragselement.Vertragselementnr
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
WHERE (dbo.Vertragselement.Aktiv = 1) AND (dbo.Vertragselement.VertragstypNr = @vertragstypnr) and (dbo.Vertragselement.SecurityLevelNr <= dbo.Get_SecurityLevel(@mitarbeiternr))
|
|
open firstloop
|
|
fetch next from firstloop into @vnr, @vtype, @aktiv
|
|
while @@fetch_status=0 begin
|
|
|
|
-- Je Root-Struktur die untergerordneten Vertragselemente auslesen
|
|
insert #tmpd (vertragselementnr, bezeichnung, parentid, vertragstypnr, aktiv) values(@tmpid,@vtype,0,@vnr, @aktiv)
|
|
declare @tmp int
|
|
declare xc cursor for
|
|
select Vertragselementnr from vertragselement
|
|
where vertragspartnernr=@vnr and
|
|
parentid =0 and
|
|
securitylevelnr <= dbo.Get_SecurityLevel(@mitarbeiternr)
|
|
and vertragselement.vertragstypnr=@vertragstypnr
|
|
open xc
|
|
fetch next from xc into @tmp
|
|
while @@fetch_status=0 begin
|
|
execute dbo.sp_vertragsuebersicht_get_struktur_down @tmp,1, @vertragstypnr, @tmpid
|
|
fetch next from xc into @tmp
|
|
end
|
|
close xc
|
|
deallocate xc
|
|
set @tmpid=@tmpid-1
|
|
|
|
fetch next from firstloop into @vnr, @vtype, @aktiv
|
|
end
|
|
close firstloop
|
|
deallocate firstloop
|
|
if @details=0 begin
|
|
delete from #tmpd where parentid > 0
|
|
end
|
|
select distinct * from #tmpd order by bezeichnung
|
|
return
|
|
SELECT distinct dbo.vertragstyp.vertragstypnr,dbo.Vertragstyp.Vertragstyp, #tmpd.*
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
#tmpd ON dbo.Vertragselement.Vertragselementnr = #tmpd.vertragselementnr INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
order by #tmpd.bezeichnung ,vertragstyp, #tmpd.parentid
|
|
|
|
return
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_TreeRoot] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
Create proc [dbo].[sp_vertragsuebersicht_get_TreeRoot]
|
|
@mitarbeiternr int,
|
|
@selectiontype int=0,
|
|
@aktiv int=0,
|
|
@suchtype int=0,
|
|
@suchstring varchar(255)='',
|
|
@partnernr int
|
|
|
|
AS
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Direkte Angabe eines Partner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @partnernr<>0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and vertragspartnernr=@partnernr
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
return
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau ohne Suche / Vertragspartner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=0 and @selectiontype=0 begin
|
|
if @aktiv=0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end else begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as Keyvalue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and dbo.vertragspartner.aktiv=1
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau ohne Suche / Vertragspartner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype = 0 and @selectiontype=1 begin
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
where dbo.vertragstyp.aktiv=1
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau ohne Suche / Vertragspartner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=1 and @selectiontype=0 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or
|
|
dbo.vertragspartner.ort like @suchstring OR dbo.Vertragspartner.PLZ like @suchstring or
|
|
dbo.Vertragspartner.Bemerkung like @suchstring or dbo.Vertragspartner.Suchbegriffe like @suchstring)
|
|
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end else begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as Keyvalue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and dbo.vertragspartner.aktiv=1
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or
|
|
dbo.vertragspartner.ort like @suchstring OR dbo.Vertragspartner.PLZ like @suchstring or
|
|
dbo.Vertragspartner.Bemerkung like @suchstring or dbo.Vertragspartner.Suchbegriffe like @suchstring)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end
|
|
end
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau Suche nach Vertragstyp
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=1 and @selectiontype=1 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
WHERE
|
|
(dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or
|
|
dbo.vertragspartner.ort like @suchstring OR dbo.Vertragspartner.PLZ like @suchstring or
|
|
dbo.Vertragspartner.Bemerkung like @suchstring or dbo.Vertragspartner.Suchbegriffe like @suchstring)
|
|
|
|
|
|
-- (dbo.Vertragspartner.NameZ1 LIKE @suchstring OR dbo.Vertragspartner.NameZ2 LIKE @suchstring OR dbo.Vertragspartner.Ort LIKE @suchstring)
|
|
and dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
where dbo.vertragstyp.aktiv=1 and dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or
|
|
dbo.vertragspartner.ort like @suchstring OR dbo.Vertragspartner.PLZ like @suchstring or
|
|
dbo.Vertragspartner.Bemerkung like @suchstring or dbo.Vertragspartner.Suchbegriffe like @suchstring)
|
|
|
|
|
|
-- (dbo.Vertragspartner.NameZ1 LIKE @suchstring OR dbo.Vertragspartner.NameZ2 LIKE @suchstring OR dbo.Vertragspartner.Ort LIKE @suchstring)
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau Suche nach Vertragselement
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=2 and @selectiontype=0 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragspartner.VertragspartnerNr AS KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.Vertragspartner.Aktiv
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr
|
|
WHERE dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(dbo.vertragselement.vertragselementnr,@suchstring)=1
|
|
ORDER BY Description
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragspartner.VertragspartnerNr AS KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.Vertragspartner.Aktiv
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr
|
|
WHERE dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(dbo.vertragselement.vertragselementnr,@suchstring)=1 and dbo.vertragspartner.aktiv=1
|
|
ORDER BY Description
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_TreeRoot_sik] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_TreeRoot_sik]
|
|
@mitarbeiternr int,
|
|
@selectiontype int=0,
|
|
@aktiv int=0,
|
|
@suchtype int=0,
|
|
@suchstring varchar(255)=''
|
|
AS
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau ohne Suche
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=0 begin
|
|
-- Selektion Vertragspartner
|
|
if @selectiontype=0 begin
|
|
if @aktiv=0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end else begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as Keyvalue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and dbo.vertragspartner.aktiv=1
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end
|
|
end
|
|
|
|
-- Selektion Vertragstyp
|
|
if @selectiontype=1 begin
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
where dbo.vertragstyp.aktiv=1
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau Suche nach Vertragspartner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=1 and @selectiontype=0 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or dbo.vertragspartner.ort like @suchstring)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end else begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as Keyvalue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and dbo.vertragspartner.aktiv=1
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or dbo.vertragspartner.ort like @suchstring)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau Suche nach Vertragstyp
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=1 and @selectiontype=1 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
WHERE (dbo.Vertragspartner.NameZ1 LIKE @suchstring OR dbo.Vertragspartner.NameZ2 LIKE @suchstring OR dbo.Vertragspartner.Ort LIKE @suchstring)
|
|
and dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
where dbo.vertragstyp.aktiv=1 and dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and
|
|
(dbo.Vertragspartner.NameZ1 LIKE @suchstring OR dbo.Vertragspartner.NameZ2 LIKE @suchstring OR dbo.Vertragspartner.Ort LIKE @suchstring)
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau Suche nach Vertragselement
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=2 and @selectiontype=0 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragspartner.VertragspartnerNr AS KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.Vertragspartner.Aktiv
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr
|
|
WHERE dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(dbo.vertragselement.vertragselementnr,@suchstring)=1
|
|
ORDER BY Description
|
|
end else begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsuebersicht_get_TreeRoot_sik_20110403] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE proc [dbo].[sp_vertragsuebersicht_get_TreeRoot_sik_20110403]
|
|
@mitarbeiternr int,
|
|
@selectiontype int=0,
|
|
@aktiv int=0,
|
|
@suchtype int=0,
|
|
@suchstring varchar(255)='',
|
|
@partnernr int
|
|
|
|
AS
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Direkte Angabe eines Partner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @partnernr<>0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and vertragspartnernr=@partnernr
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
return
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau ohne Suche / Vertragspartner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=0 and @selectiontype=0 begin
|
|
if @aktiv=0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end else begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as Keyvalue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and dbo.vertragspartner.aktiv=1
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau ohne Suche / Vertragspartner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype = 0 and @selectiontype=1 begin
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr
|
|
where dbo.vertragstyp.aktiv=1
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau ohne Suche / Vertragspartner
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=1 and @selectiontype=0 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or dbo.vertragspartner.ort like @suchstring)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end else begin
|
|
select dbo.Vertragspartner.VertragspartnerNr as Keyvalue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.vertragspartner.aktiv
|
|
from dbo.Vertragspartner
|
|
where dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and dbo.vertragspartner.aktiv=1
|
|
and (dbo.vertragspartner.namez1 like @suchstring or dbo.vertragspartner.namez2 like @suchstring or dbo.vertragspartner.ort like @suchstring)
|
|
order by dbo.vertragspartner.namez1, dbo.vertragspartner.namez2, dbo.vertragspartner.ort
|
|
end
|
|
end
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau Suche nach Vertragstyp
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=1 and @selectiontype=1 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
WHERE (dbo.Vertragspartner.NameZ1 LIKE @suchstring OR dbo.Vertragspartner.NameZ2 LIKE @suchstring OR dbo.Vertragspartner.Ort LIKE @suchstring)
|
|
and dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragstyp.Vertragstypnr as Keyvalue , dbo.Vertragstyp.Vertragstyp AS Description
|
|
FROM dbo.Vertragselement INNER JOIN
|
|
dbo.Vertragstyp ON dbo.Vertragselement.VertragstypNr = dbo.Vertragstyp.Vertragstypnr INNER JOIN
|
|
dbo.Vertragspartner ON dbo.Vertragselement.VertragspartnerNr = dbo.Vertragspartner.VertragspartnerNr
|
|
where dbo.vertragstyp.aktiv=1 and dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr) and
|
|
(dbo.Vertragspartner.NameZ1 LIKE @suchstring OR dbo.Vertragspartner.NameZ2 LIKE @suchstring OR dbo.Vertragspartner.Ort LIKE @suchstring)
|
|
order by dbo.vertragstyp.vertragstyp
|
|
end
|
|
end
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Tree-Aufbau Suche nach Vertragselement
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------
|
|
if @suchtype=2 and @selectiontype=0 begin
|
|
set @suchstring='%'+@suchstring+'%'
|
|
if @aktiv=0 begin
|
|
SELECT DISTINCT dbo.Vertragspartner.VertragspartnerNr AS KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.Vertragspartner.Aktiv
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr
|
|
WHERE dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(dbo.vertragselement.vertragselementnr,@suchstring)=1
|
|
ORDER BY Description
|
|
end else begin
|
|
SELECT DISTINCT dbo.Vertragspartner.VertragspartnerNr AS KeyValue,
|
|
dbo.Vertragspartner.NameZ1 + ' ' + dbo.Vertragspartner.NameZ2 + ', ' + dbo.Vertragspartner.PLZ + ' ' + dbo.Vertragspartner.Ort AS Description,
|
|
dbo.Vertragspartner.Aktiv
|
|
FROM dbo.Vertragspartner INNER JOIN
|
|
dbo.Vertragselement ON dbo.Vertragspartner.VertragspartnerNr = dbo.Vertragselement.VertragspartnerNr
|
|
WHERE dbo.vertragspartner.securitylevelnr <= dbo.get_securitylevel(@mitarbeiternr)
|
|
and dbo.search_vertragselement(dbo.vertragselement.vertragselementnr,@suchstring)=1 and dbo.vertragspartner.aktiv=1
|
|
ORDER BY Description
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sp_vertragsverwaltung_pendenzenliste] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
Create PROCEDURE [dbo].[sp_vertragsverwaltung_pendenzenliste]
|
|
@Mitarbeiternr int,
|
|
@pendenzstatusnr int
|
|
|
|
|
|
AS
|
|
-- Pendenzart 1 = Offen
|
|
if @pendenzstatusnr<>-1 begin
|
|
SELECT dbo.Pendenz.PendenzNr, dbo.Pendenz.VertragselementNr, dbo.Pendenz.Verantwortlich, dbo.Pendenz.PendenzStatusNr,
|
|
dbo.Pendenz.Bezeichnung, dbo.Pendenz.Beschreibung, dbo.Pendenz.Termin, dbo.Pendenz.Aktiv, dbo.Pendenz.Erstellt_am, dbo.Pendenz.Mutiert_am,
|
|
dbo.Pendenz.Mutierer, dbo.Pendenz.MandantNr, dbo.Pendenz.SecurityLevelNr, dbo.Pendenzstatus.Bezeichnung AS Pendenzstatus,
|
|
ISNULL(dbo.Vertragselement.Bezeichnung, '') AS Vertragselement
|
|
FROM dbo.Pendenz INNER JOIN
|
|
dbo.Pendenzstatus ON dbo.Pendenz.PendenzStatusNr = dbo.Pendenzstatus.PendenzStatusNr LEFT OUTER JOIN
|
|
dbo.Vertragselement ON dbo.Pendenz.VertragselementNr = dbo.Vertragselement.Vertragselementnr
|
|
where (dbo.pendenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) or dbo.pendenz.mutierer=@mitarbeiternr)
|
|
and dbo.pendenz.pendenzstatusnr=@pendenzstatusnr
|
|
order by Termin asc
|
|
end
|
|
--
|
|
---- Pendenzart 2 = In Bearbeitung
|
|
--if @pendenzstatusnr=2 begin
|
|
-- SELECT dbo.Pendenz.PendenzNr, dbo.Pendenz.VertragselementNr, dbo.Pendenz.Verantwortlich, dbo.Pendenz.PendenzStatusNr,
|
|
-- dbo.Pendenz.Bezeichnung, dbo.Pendenz.Beschreibung, dbo.Pendenz.Termin, dbo.Pendenz.Aktiv, dbo.Pendenz.Erstellt_am, dbo.Pendenz.Mutiert_am,
|
|
-- dbo.Pendenz.Mutierer, dbo.Pendenz.MandantNr, dbo.Pendenz.SecurityLevelNr, dbo.Pendenzstatus.Bezeichnung AS Pendenzstatus,
|
|
-- ISNULL(dbo.Vertragselement.Bezeichnung, '') AS Vertragselement
|
|
-- FROM dbo.Pendenz INNER JOIN
|
|
-- dbo.Pendenzstatus ON dbo.Pendenz.PendenzStatusNr = dbo.Pendenzstatus.PendenzStatusNr LEFT OUTER JOIN
|
|
-- dbo.Vertragselement ON dbo.Pendenz.VertragselementNr = dbo.Vertragselement.Vertragselementnr
|
|
-- where (dbo.pendenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) or dbo.pendenz.mutierer=@mitarbeiternr)
|
|
-- and dbo.pendenz.pendenzstatusnr=2
|
|
-- order by Termin asc
|
|
--end
|
|
--
|
|
---- Pendenzart 3 = Erledigt
|
|
--if @pendenzstatusnr=3 begin
|
|
-- SELECT dbo.Pendenz.PendenzNr, dbo.Pendenz.VertragselementNr, dbo.Pendenz.Verantwortlich, dbo.Pendenz.PendenzStatusNr,
|
|
-- dbo.Pendenz.Bezeichnung, dbo.Pendenz.Beschreibung, dbo.Pendenz.Termin, dbo.Pendenz.Aktiv, dbo.Pendenz.Erstellt_am, dbo.Pendenz.Mutiert_am,
|
|
-- dbo.Pendenz.Mutierer, dbo.Pendenz.MandantNr, dbo.Pendenz.SecurityLevelNr, dbo.Pendenzstatus.Bezeichnung AS Pendenzstatus,
|
|
-- ISNULL(dbo.Vertragselement.Bezeichnung, '') AS Vertragselement
|
|
-- FROM dbo.Pendenz INNER JOIN
|
|
-- dbo.Pendenzstatus ON dbo.Pendenz.PendenzStatusNr = dbo.Pendenzstatus.PendenzStatusNr LEFT OUTER JOIN
|
|
-- dbo.Vertragselement ON dbo.Pendenz.VertragselementNr = dbo.Vertragselement.Vertragselementnr
|
|
-- where (dbo.pendenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) or dbo.pendenz.mutierer=@mitarbeiternr)
|
|
-- and dbo.pendenz.pendenzstatusnr=3
|
|
-- order by Termin asc
|
|
--end
|
|
--
|
|
---- Pendenzart 4 = Hinfällig
|
|
--if @pendenzstatusnr=4 begin
|
|
-- SELECT dbo.Pendenz.PendenzNr, dbo.Pendenz.VertragselementNr, dbo.Pendenz.Verantwortlich, dbo.Pendenz.PendenzStatusNr,
|
|
-- dbo.Pendenz.Bezeichnung, dbo.Pendenz.Beschreibung, dbo.Pendenz.Termin, dbo.Pendenz.Aktiv, dbo.Pendenz.Erstellt_am, dbo.Pendenz.Mutiert_am,
|
|
-- dbo.Pendenz.Mutierer, dbo.Pendenz.MandantNr, dbo.Pendenz.SecurityLevelNr, dbo.Pendenzstatus.Bezeichnung AS Pendenzstatus,
|
|
-- ISNULL(dbo.Vertragselement.Bezeichnung, '') AS Vertragselement
|
|
-- FROM dbo.Pendenz INNER JOIN
|
|
-- dbo.Pendenzstatus ON dbo.Pendenz.PendenzStatusNr = dbo.Pendenzstatus.PendenzStatusNr LEFT OUTER JOIN
|
|
-- dbo.Vertragselement ON dbo.Pendenz.VertragselementNr = dbo.Vertragselement.Vertragselementnr
|
|
-- where (dbo.pendenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) or dbo.pendenz.mutierer=@mitarbeiternr)
|
|
-- and dbo.pendenz.pendenzstatusnr=4
|
|
-- order by Termin asc
|
|
--end
|
|
|
|
-- Pendenzart -1 = Alle
|
|
if @pendenzstatusnr=-1 begin
|
|
SELECT dbo.Pendenz.PendenzNr, dbo.Pendenz.VertragselementNr, dbo.Pendenz.Verantwortlich, dbo.Pendenz.PendenzStatusNr,
|
|
dbo.Pendenz.Bezeichnung, dbo.Pendenz.Beschreibung, dbo.Pendenz.Termin, dbo.Pendenz.Aktiv, dbo.Pendenz.Erstellt_am, dbo.Pendenz.Mutiert_am,
|
|
dbo.Pendenz.Mutierer, dbo.Pendenz.MandantNr, dbo.Pendenz.SecurityLevelNr, dbo.Pendenzstatus.Bezeichnung AS Pendenzstatus,
|
|
ISNULL(dbo.Vertragselement.Bezeichnung, '') AS Vertragselement
|
|
FROM dbo.Pendenz INNER JOIN
|
|
dbo.Pendenzstatus ON dbo.Pendenz.PendenzStatusNr = dbo.Pendenzstatus.PendenzStatusNr LEFT OUTER JOIN
|
|
dbo.Vertragselement ON dbo.Pendenz.VertragselementNr = dbo.Vertragselement.Vertragselementnr
|
|
where (dbo.pendenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) or dbo.pendenz.mutierer=@mitarbeiternr)
|
|
order by Termin asc
|
|
end
|
|
|
|
-- Pendenzart -2 = Alle im Status Offen(1) und In Bearbeitung (2)
|
|
--if @pendenzstatusnr=-2 begin
|
|
-- SELECT dbo.Pendenz.PendenzNr, dbo.Pendenz.VertragselementNr, dbo.Pendenz.Verantwortlich, dbo.Pendenz.PendenzStatusNr,
|
|
-- dbo.Pendenz.Bezeichnung, dbo.Pendenz.Beschreibung, dbo.Pendenz.Termin, dbo.Pendenz.Aktiv, dbo.Pendenz.Erstellt_am, dbo.Pendenz.Mutiert_am,
|
|
-- dbo.Pendenz.Mutierer, dbo.Pendenz.MandantNr, dbo.Pendenz.SecurityLevelNr, dbo.Pendenzstatus.Bezeichnung AS Pendenzstatus,
|
|
-- ISNULL(dbo.Vertragselement.Bezeichnung, '') AS Vertragselement
|
|
-- FROM dbo.Pendenz INNER JOIN
|
|
-- dbo.Pendenzstatus ON dbo.Pendenz.PendenzStatusNr = dbo.Pendenzstatus.PendenzStatusNr LEFT OUTER JOIN
|
|
-- dbo.Vertragselement ON dbo.Pendenz.VertragselementNr = dbo.Vertragselement.Vertragselementnr
|
|
-- where (dbo.pendenz.SecurityLevelnr<=dbo.Get_SecurityLevel(@mitarbeiternr) or dbo.pendenz.mutierer=@mitarbeiternr)
|
|
-- and dbo.pendenz.pendenzstatusnr<3
|
|
-- order by Termin asc
|
|
--end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
/****** Object: StoredProcedure [dbo].[sys_CrossTab] Script Date: 27.01.2017 08:57:28 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
CREATE proc [dbo].[sys_CrossTab]
|
|
@SQLSource varchar(8000),
|
|
@ColFieldID varchar(8000),
|
|
@ColFieldName varchar(8000),
|
|
@ColFieldOrder varchar(8000),
|
|
@CalcFieldName varchar(8000),
|
|
@RowFieldNames varchar(8000),
|
|
@TempTableName varchar(200) = null,
|
|
@CalcOperation varchar(50) = 'sum',
|
|
@Debug bit = 0,
|
|
@SourceFilter varchar(8000) = null,
|
|
@NumColOrdering bit = 0,
|
|
@RowTotals varchar(100) = null,
|
|
@ColTotals varchar(100) = null,
|
|
@OrderBy varchar(8000) = null,
|
|
@CalcFieldType varchar(100) = 'int'
|
|
as
|
|
|
|
|
|
/*-----------------------------------------------------------------------------------------
|
|
' Procedure : sys_CrossTab
|
|
' DateTime : 11 May 2006 17:59:56
|
|
' Author : Keith Fletcher
|
|
' Ver : 1.5
|
|
' Purpose : Generate a cross-tab result set on a given SQL source
|
|
' To Check :
|
|
' Changes : KF - 23 May 2006 - Added a parameter to order the columns in the crosstab (Ver 1.1)
|
|
' Changes : KF - 24 Aug 2006 - Added a parameter for the where clause of the source (Ver 1.2)
|
|
' Changes : KF - 05 Oct 2006 - Added alpha/num column ordering, row and column totals (Ver 1.3)
|
|
' Changes : KF - 06 Oct 2006 - Added CalcFieldType (Ver 1.4)
|
|
' Changes : KF - 16 Mar 2007 - Touched up the code comments (Ver 1.5)
|
|
'-----------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*
|
|
-- Start of debugging stuff
|
|
declare @SQLSource varchar(8000)
|
|
declare @ColFieldID varchar(8000)
|
|
declare @ColFieldName varchar(8000)
|
|
declare @ColFieldOrder varchar(8000)
|
|
declare @CalcFieldName varchar(8000)
|
|
declare @RowFieldNames varchar(8000)
|
|
declare @TempTableName varchar(200)
|
|
declare @CalcOperation varchar(50)
|
|
declare @Debug bit
|
|
declare @SourceFilter varchar(8000)
|
|
declare @NumColOrdering bit
|
|
declare @RowTotals varchar(100)
|
|
declare @ColTotals varchar(100)
|
|
declare @OrderBy varchar(8000)
|
|
declare @CalcFieldType varchar(100)
|
|
|
|
|
|
set @SQLSource = 'Northwind..[Order Details] Ord inner join Northwind..Products Prd on Ord.ProductID = Prd.ProductID'
|
|
set @ColFieldID = 'Ord.ProductID'
|
|
set @ColFieldName = 'Prd.ProductName'
|
|
set @ColFieldOrder = 'Prd.ProductName'
|
|
set @CalcFieldName = 'Quantity'
|
|
set @RowFieldNames = 'OrderID'
|
|
set @TempTableName = '#CrossTab'
|
|
set @CalcOperation = 'sum'
|
|
set @Debug = 1
|
|
set @SourceFilter = null
|
|
set @NumColOrdering = 0
|
|
set @RowTotals = 'RowTotal'
|
|
set @ColTotals = 'ColTotal'
|
|
set @OrderBy = null
|
|
set @CalcFieldType = 'int'
|
|
-- End of debugging stuff
|
|
*/
|
|
|
|
|
|
|
|
set nocount on
|
|
|
|
|
|
-----=====******--~-~--~~---~-~---~~-~-~---~---~--~--~~~-~-~---~---~--~*****=====-----
|
|
-- Variable declaration
|
|
|
|
|
|
-- These are all my 'buffer' variables used to build up the SQL queries. If you wish to have a query that's
|
|
-- culture-aware, you'll need to change these to nvarchars. You'll also need to set the maximum size to
|
|
-- 4000 (@MaxVarSize)
|
|
|
|
declare @MaxVarSize int
|
|
set @MaxVarSize = 8000
|
|
|
|
declare @SQLCase1 varchar(8000) declare @SQLCase2 varchar(8000) declare @SQLCase3 varchar(8000)
|
|
declare @SQLCase4 varchar(8000) declare @SQLCase5 varchar(8000) declare @SQLCase6 varchar(8000)
|
|
declare @SQLCase7 varchar(8000) declare @SQLCase8 varchar(8000) declare @SQLCase9 varchar(8000)
|
|
declare @SQLCase10 varchar(8000) declare @SQLCase11 varchar(8000) declare @SQLCase12 varchar(8000)
|
|
declare @SQLCase13 varchar(8000) declare @SQLCase14 varchar(8000) declare @SQLCase15 varchar(8000)
|
|
declare @SQLCase16 varchar(8000) declare @SQLCase17 varchar(8000) declare @SQLCase18 varchar(8000)
|
|
declare @SQLCase19 varchar(8000) declare @SQLCase20 varchar(8000) declare @SQLCase21 varchar(8000)
|
|
declare @SQLCase22 varchar(8000) declare @SQLCase23 varchar(8000) declare @SQLCase24 varchar(8000)
|
|
declare @SQLCase25 varchar(8000) declare @SQLCase26 varchar(8000) declare @SQLCase27 varchar(8000)
|
|
declare @SQLCase28 varchar(8000) declare @SQLCase29 varchar(8000) declare @SQLCase30 varchar(8000)
|
|
declare @SQLCase31 varchar(8000) declare @SQLCase32 varchar(8000) declare @SQLCase33 varchar(8000)
|
|
declare @SQLCase34 varchar(8000) declare @SQLCase35 varchar(8000) declare @SQLCase36 varchar(8000)
|
|
declare @SQLCase37 varchar(8000) declare @SQLCase38 varchar(8000) declare @SQLCase39 varchar(8000)
|
|
declare @SQLCase40 varchar(8000) declare @SQLCase41 varchar(8000) declare @SQLCase42 varchar(8000)
|
|
declare @SQLCase43 varchar(8000) declare @SQLCase44 varchar(8000) declare @SQLCase45 varchar(8000)
|
|
declare @SQLCase46 varchar(8000) declare @SQLCase47 varchar(8000) declare @SQLCase48 varchar(8000)
|
|
declare @SQLCase49 varchar(8000) declare @SQLCase50 varchar(8000)
|
|
|
|
declare @SQLCaseLine varchar(8000)
|
|
declare @SQLCaseLevel tinyint
|
|
declare @SQLCaseLen int
|
|
|
|
declare @SQLCol1 varchar(8000) declare @SQLCol2 varchar(8000) declare @SQLCol3 varchar(8000)
|
|
declare @SQLCol4 varchar(8000) declare @SQLCol5 varchar(8000) declare @SQLCol6 varchar(8000)
|
|
declare @SQLCol7 varchar(8000) declare @SQLCol8 varchar(8000) declare @SQLCol9 varchar(8000)
|
|
declare @SQLCol10 varchar(8000) declare @SQLCol11 varchar(8000) declare @SQLCol12 varchar(8000)
|
|
declare @SQLCol13 varchar(8000) declare @SQLCol14 varchar(8000) declare @SQLCol15 varchar(8000)
|
|
declare @SQLCol16 varchar(8000) declare @SQLCol17 varchar(8000) declare @SQLCol18 varchar(8000)
|
|
declare @SQLCol19 varchar(8000) declare @SQLCol20 varchar(8000) declare @SQLCol21 varchar(8000)
|
|
declare @SQLCol22 varchar(8000) declare @SQLCol23 varchar(8000) declare @SQLCol24 varchar(8000)
|
|
declare @SQLCol25 varchar(8000) declare @SQLCol26 varchar(8000) declare @SQLCol27 varchar(8000)
|
|
declare @SQLCol28 varchar(8000) declare @SQLCol29 varchar(8000) declare @SQLCol30 varchar(8000)
|
|
declare @SQLCol31 varchar(8000) declare @SQLCol32 varchar(8000) declare @SQLCol33 varchar(8000)
|
|
declare @SQLCol34 varchar(8000) declare @SQLCol35 varchar(8000) declare @SQLCol36 varchar(8000)
|
|
declare @SQLCol37 varchar(8000) declare @SQLCol38 varchar(8000) declare @SQLCol39 varchar(8000)
|
|
declare @SQLCol40 varchar(8000) declare @SQLCol41 varchar(8000) declare @SQLCol42 varchar(8000)
|
|
declare @SQLCol43 varchar(8000) declare @SQLCol44 varchar(8000) declare @SQLCol45 varchar(8000)
|
|
declare @SQLCol46 varchar(8000) declare @SQLCol47 varchar(8000) declare @SQLCol48 varchar(8000)
|
|
declare @SQLCol49 varchar(8000) declare @SQLCol50 varchar(8000)
|
|
|
|
declare @SQLColLine varchar(8000)
|
|
declare @SQLColLevel tinyint
|
|
declare @SQLColLen int
|
|
|
|
declare @SQLTot1 varchar(8000) declare @SQLTot2 varchar(8000) declare @SQLTot3 varchar(8000)
|
|
declare @SQLTot4 varchar(8000) declare @SQLTot5 varchar(8000) declare @SQLTot6 varchar(8000)
|
|
declare @SQLTot7 varchar(8000) declare @SQLTot8 varchar(8000) declare @SQLTot9 varchar(8000)
|
|
declare @SQLTot10 varchar(8000) declare @SQLTot11 varchar(8000) declare @SQLTot12 varchar(8000)
|
|
declare @SQLTot13 varchar(8000) declare @SQLTot14 varchar(8000) declare @SQLTot15 varchar(8000)
|
|
declare @SQLTot16 varchar(8000) declare @SQLTot17 varchar(8000) declare @SQLTot18 varchar(8000)
|
|
declare @SQLTot19 varchar(8000) declare @SQLTot20 varchar(8000) declare @SQLTot21 varchar(8000)
|
|
declare @SQLTot22 varchar(8000) declare @SQLTot23 varchar(8000) declare @SQLTot24 varchar(8000)
|
|
declare @SQLTot25 varchar(8000) declare @SQLTot26 varchar(8000) declare @SQLTot27 varchar(8000)
|
|
declare @SQLTot28 varchar(8000) declare @SQLTot29 varchar(8000) declare @SQLTot30 varchar(8000)
|
|
declare @SQLTot31 varchar(8000) declare @SQLTot32 varchar(8000) declare @SQLTot33 varchar(8000)
|
|
declare @SQLTot34 varchar(8000) declare @SQLTot35 varchar(8000) declare @SQLTot36 varchar(8000)
|
|
declare @SQLTot37 varchar(8000) declare @SQLTot38 varchar(8000) declare @SQLTot39 varchar(8000)
|
|
declare @SQLTot40 varchar(8000) declare @SQLTot41 varchar(8000) declare @SQLTot42 varchar(8000)
|
|
declare @SQLTot43 varchar(8000) declare @SQLTot44 varchar(8000) declare @SQLTot45 varchar(8000)
|
|
declare @SQLTot46 varchar(8000) declare @SQLTot47 varchar(8000) declare @SQLTot48 varchar(8000)
|
|
declare @SQLTot49 varchar(8000) declare @SQLTot50 varchar(8000)
|
|
|
|
declare @SQLTotLine varchar(8000)
|
|
declare @SQLTotLevel tinyint
|
|
declare @SQLTotLen int
|
|
|
|
declare @SQLIns1 varchar(8000) declare @SQLIns2 varchar(8000) declare @SQLIns3 varchar(8000)
|
|
declare @SQLIns4 varchar(8000) declare @SQLIns5 varchar(8000) declare @SQLIns6 varchar(8000)
|
|
declare @SQLIns7 varchar(8000) declare @SQLIns8 varchar(8000) declare @SQLIns9 varchar(8000)
|
|
declare @SQLIns10 varchar(8000) declare @SQLIns11 varchar(8000) declare @SQLIns12 varchar(8000)
|
|
declare @SQLIns13 varchar(8000) declare @SQLIns14 varchar(8000) declare @SQLIns15 varchar(8000)
|
|
declare @SQLIns16 varchar(8000) declare @SQLIns17 varchar(8000) declare @SQLIns18 varchar(8000)
|
|
declare @SQLIns19 varchar(8000) declare @SQLIns20 varchar(8000) declare @SQLIns21 varchar(8000)
|
|
declare @SQLIns22 varchar(8000) declare @SQLIns23 varchar(8000) declare @SQLIns24 varchar(8000)
|
|
declare @SQLIns25 varchar(8000) declare @SQLIns26 varchar(8000) declare @SQLIns27 varchar(8000)
|
|
declare @SQLIns28 varchar(8000) declare @SQLIns29 varchar(8000) declare @SQLIns30 varchar(8000)
|
|
|
|
declare @SQLInsLine varchar(8000)
|
|
declare @SQLInsLevel tinyint
|
|
declare @SQLInsLen int
|
|
|
|
declare @SQLTtC1 varchar(8000) declare @SQLTtC2 varchar(8000) declare @SQLTtC3 varchar(8000)
|
|
declare @SQLTtC4 varchar(8000) declare @SQLTtC5 varchar(8000) declare @SQLTtC6 varchar(8000)
|
|
declare @SQLTtC7 varchar(8000) declare @SQLTtC8 varchar(8000) declare @SQLTtC9 varchar(8000)
|
|
declare @SQLTtC10 varchar(8000) declare @SQLTtC11 varchar(8000) declare @SQLTtC12 varchar(8000)
|
|
declare @SQLTtC13 varchar(8000) declare @SQLTtC14 varchar(8000) declare @SQLTtC15 varchar(8000)
|
|
declare @SQLTtC16 varchar(8000) declare @SQLTtC17 varchar(8000) declare @SQLTtC18 varchar(8000)
|
|
declare @SQLTtC19 varchar(8000) declare @SQLTtC20 varchar(8000) declare @SQLTtC21 varchar(8000)
|
|
declare @SQLTtC22 varchar(8000) declare @SQLTtC23 varchar(8000) declare @SQLTtC24 varchar(8000)
|
|
declare @SQLTtC25 varchar(8000) declare @SQLTtC26 varchar(8000) declare @SQLTtC27 varchar(8000)
|
|
declare @SQLTtC28 varchar(8000) declare @SQLTtC29 varchar(8000) declare @SQLTtC30 varchar(8000)
|
|
|
|
declare @SQLTtCLine varchar(8000)
|
|
declare @SQLTtCLevel tinyint
|
|
declare @SQLTtCLen int
|
|
|
|
|
|
declare @ColID varchar(100)
|
|
declare @ColName varchar(200)
|
|
declare @ColTotal varchar(100)
|
|
declare @GrandTotal varchar(100)
|
|
declare @ColNo int
|
|
|
|
declare @StrippedRowFieldNames varchar(8000)
|
|
declare @CalcScript varchar(100)
|
|
|
|
declare @NewLine char(2)
|
|
|
|
declare @AddWhere varchar(8000)
|
|
declare @AddOrder varchar(8000)
|
|
|
|
|
|
-----=====******--~-~--~~---~-~---~~-~-~---~---~--~--~~~-~-~---~---~--~*****=====-----
|
|
-- Variable initialisation
|
|
|
|
|
|
set @SQLCase1 = '' set @SQLCase2 = '' set @SQLCase3 = '' set @SQLCase4 = ''
|
|
set @SQLCase5 = '' set @SQLCase6 = '' set @SQLCase7 = '' set @SQLCase8 = ''
|
|
set @SQLCase9 = '' set @SQLCase10 = '' set @SQLCase11 = '' set @SQLCase12 = ''
|
|
set @SQLCase13 = '' set @SQLCase14 = '' set @SQLCase15 = '' set @SQLCase16 = ''
|
|
set @SQLCase17 = '' set @SQLCase18 = '' set @SQLCase19 = '' set @SQLCase20 = ''
|
|
set @SQLCase21 = '' set @SQLCase22 = '' set @SQLCase23 = '' set @SQLCase24 = ''
|
|
set @SQLCase25 = '' set @SQLCase26 = '' set @SQLCase27 = '' set @SQLCase28 = ''
|
|
set @SQLCase29 = '' set @SQLCase30 = '' set @SQLCase31 = '' set @SQLCase32 = ''
|
|
set @SQLCase33 = '' set @SQLCase34 = '' set @SQLCase35 = '' set @SQLCase36 = ''
|
|
set @SQLCase37 = '' set @SQLCase38 = '' set @SQLCase39 = '' set @SQLCase40 = ''
|
|
set @SQLCase41 = '' set @SQLCase42 = '' set @SQLCase43 = '' set @SQLCase44 = ''
|
|
set @SQLCase45 = '' set @SQLCase46 = '' set @SQLCase47 = '' set @SQLCase48 = ''
|
|
set @SQLCase49 = '' set @SQLCase50 = ''
|
|
|
|
set @SQLCaseLine = ''
|
|
set @SQLCaseLevel = 1
|
|
set @SQLCaseLen = 0
|
|
|
|
set @SQLCol1 = '' set @SQLCol2 = '' set @SQLCol3 = '' set @SQLCol4 = ''
|
|
set @SQLCol5 = '' set @SQLCol6 = '' set @SQLCol7 = '' set @SQLCol8 = ''
|
|
set @SQLCol9 = '' set @SQLCol10 = '' set @SQLCol11 = '' set @SQLCol12 = ''
|
|
set @SQLCol13 = '' set @SQLCol14 = '' set @SQLCol15 = '' set @SQLCol16 = ''
|
|
set @SQLCol17 = '' set @SQLCol18 = '' set @SQLCol19 = '' set @SQLCol20 = ''
|
|
set @SQLCol21 = '' set @SQLCol22 = '' set @SQLCol23 = '' set @SQLCol24 = ''
|
|
set @SQLCol25 = '' set @SQLCol26 = '' set @SQLCol27 = '' set @SQLCol28 = ''
|
|
set @SQLCol29 = '' set @SQLCol30 = '' set @SQLCol31 = '' set @SQLCol32 = ''
|
|
set @SQLCol33 = '' set @SQLCol34 = '' set @SQLCol35 = '' set @SQLCol36 = ''
|
|
set @SQLCol37 = '' set @SQLCol38 = '' set @SQLCol39 = '' set @SQLCol40 = ''
|
|
set @SQLCol41 = '' set @SQLCol42 = '' set @SQLCol43 = '' set @SQLCol44 = ''
|
|
set @SQLCol45 = '' set @SQLCol46 = '' set @SQLCol47 = '' set @SQLCol48 = ''
|
|
set @SQLCol49 = '' set @SQLCol50 = ''
|
|
|
|
set @SQLColLine = ''
|
|
set @SQLColLevel = 1
|
|
set @SQLColLen = 0
|
|
|
|
set @SQLTot1 = '' set @SQLTot2 = '' set @SQLTot3 = '' set @SQLTot4 = ''
|
|
set @SQLTot5 = '' set @SQLTot6 = '' set @SQLTot7 = '' set @SQLTot8 = ''
|
|
set @SQLTot9 = '' set @SQLTot10 = '' set @SQLTot11 = '' set @SQLTot12 = ''
|
|
set @SQLTot13 = '' set @SQLTot14 = '' set @SQLTot15 = '' set @SQLTot16 = ''
|
|
set @SQLTot17 = '' set @SQLTot18 = '' set @SQLTot19 = '' set @SQLTot20 = ''
|
|
set @SQLTot21 = '' set @SQLTot22 = '' set @SQLTot23 = '' set @SQLTot24 = ''
|
|
set @SQLTot25 = '' set @SQLTot26 = '' set @SQLTot27 = '' set @SQLTot28 = ''
|
|
set @SQLTot29 = '' set @SQLTot30 = '' set @SQLTot31 = '' set @SQLTot32 = ''
|
|
set @SQLTot33 = '' set @SQLTot34 = '' set @SQLTot35 = '' set @SQLTot36 = ''
|
|
set @SQLTot37 = '' set @SQLTot38 = '' set @SQLTot39 = '' set @SQLTot40 = ''
|
|
set @SQLTot41 = '' set @SQLTot42 = '' set @SQLTot43 = '' set @SQLTot44 = ''
|
|
set @SQLTot45 = '' set @SQLTot46 = '' set @SQLTot47 = '' set @SQLTot48 = ''
|
|
set @SQLTot49 = '' set @SQLTot50 = ''
|
|
|
|
set @SQLTotLine = ''
|
|
set @SQLTotLevel = 1
|
|
set @SQLTotLen = 0
|
|
|
|
set @SQLIns1 = '' set @SQLIns2 = '' set @SQLIns3 = '' set @SQLIns4 = ''
|
|
set @SQLIns5 = '' set @SQLIns6 = '' set @SQLIns7 = '' set @SQLIns8 = ''
|
|
set @SQLIns9 = '' set @SQLIns10 = '' set @SQLIns11 = '' set @SQLIns12 = ''
|
|
set @SQLIns13 = '' set @SQLIns14 = '' set @SQLIns15 = '' set @SQLIns16 = ''
|
|
set @SQLIns17 = '' set @SQLIns18 = '' set @SQLIns19 = '' set @SQLIns20 = ''
|
|
set @SQLIns21 = '' set @SQLIns22 = '' set @SQLIns23 = '' set @SQLIns24 = ''
|
|
set @SQLIns25 = '' set @SQLIns26 = '' set @SQLIns27 = '' set @SQLIns28 = ''
|
|
set @SQLIns29 = '' set @SQLIns30 = ''
|
|
|
|
set @SQLInsLine = ''
|
|
set @SQLInsLevel = 1
|
|
set @SQLInsLen = 0
|
|
|
|
set @SQLTtC1 = '' set @SQLTtC2 = '' set @SQLTtC3 = '' set @SQLTtC4 = ''
|
|
set @SQLTtC5 = '' set @SQLTtC6 = '' set @SQLTtC7 = '' set @SQLTtC8 = ''
|
|
set @SQLTtC9 = '' set @SQLTtC10 = '' set @SQLTtC11 = '' set @SQLTtC12 = ''
|
|
set @SQLTtC13 = '' set @SQLTtC14 = '' set @SQLTtC15 = '' set @SQLTtC16 = ''
|
|
set @SQLTtC17 = '' set @SQLTtC18 = '' set @SQLTtC19 = '' set @SQLTtC20 = ''
|
|
set @SQLTtC21 = '' set @SQLTtC22 = '' set @SQLTtC23 = '' set @SQLTtC24 = ''
|
|
set @SQLTtC25 = '' set @SQLTtC26 = '' set @SQLTtC27 = '' set @SQLTtC28 = ''
|
|
set @SQLTtC29 = '' set @SQLTtC30 = ''
|
|
|
|
set @SQLTtCLine = ''
|
|
set @SQLTtCLevel = 1
|
|
set @SQLTtCLen = 0
|
|
|
|
|
|
set @ColNo = 1
|
|
|
|
set @StrippedRowFieldNames = @RowFieldNames
|
|
|
|
set @NewLine = char(13) + char(10)
|
|
|
|
|
|
if @SourceFilter is null
|
|
set @AddWhere = ''
|
|
else
|
|
set @AddWhere = ' and ' + @SourceFilter
|
|
|
|
if @OrderBy is null
|
|
set @AddOrder = ''
|
|
else
|
|
set @AddOrder = ' order by ' + @OrderBy
|
|
|
|
|
|
-----=====******--~-~--~~---~-~---~~-~-~---~---~--~--~~~-~-~---~---~--~*****=====-----
|
|
-- Get the column names and ID's
|
|
|
|
-- We want to collect a list of all the columns that we need to create for the cross tab.
|
|
-- This is done by doing a select on our source data, and inserting the first occurence
|
|
-- of each data item that we find in the field pointed to by @ColFieldID. While we're at
|
|
-- it, we might as well put the column in the correct display order.
|
|
|
|
create table #Columns (ColID varchar(100),
|
|
ColName varchar(200),
|
|
ColOrderNum bigint identity(1,1))
|
|
|
|
|
|
-- Add a field to keep a running total of the column values. This needs to be added
|
|
-- dynamically, as we don't know the data type of this field upfront.
|
|
exec ('alter table #Columns add ColTotal ' + @CalcFieldType)
|
|
|
|
|
|
-- If we need to calculate the column totals, build the command that we need to calculate
|
|
-- it. Both the aggregate type and the data type are not known, so we do it dynamically.
|
|
-- If we don't need to calculate column totals, we'll set it to null.
|
|
if @ColTotals is not null
|
|
set @CalcScript = @CalcOperation + '(cast(' + @CalcFieldName + ' as ' + @CalcFieldType + '))'
|
|
else
|
|
set @CalcScript = '0'
|
|
|
|
|
|
-- Here's were it all comes together. We create an INSERT statement that adds all of the
|
|
-- column ID's and names to our temp table. We trim the fields and calculate the column
|
|
-- totals. This is the first hit on our source data.
|
|
|
|
-- We're not worried about the ordering of the columns...
|
|
if @ColFieldOrder is null
|
|
exec ('insert into #Columns (ColID, ColName, ColTotal) select ltrim(rtrim(isnull(cast('
|
|
+ @ColFieldID + ' as varchar(100)), ''''))), ltrim(rtrim(isnull(cast('
|
|
+ @ColFieldName + ' as varchar(100)), ''''))), ' + @CalcScript + ' from ' + @SQLSource
|
|
+ ' where 1=1 ' + @AddWhere + ' group by ' + @ColFieldID + ', ' + @ColFieldName)
|
|
|
|
else
|
|
begin
|
|
-- We are concerned with column ordering, and they must be sorted alphanumerically
|
|
if @NumColOrdering = 0
|
|
exec ('insert into #Columns (ColID, ColName, ColTotal) select ltrim(rtrim(isnull(cast('
|
|
+ @ColFieldID + ' as varchar(100)), ''''))), ltrim(rtrim(isnull(cast(' + @ColFieldName +
|
|
' as varchar(100)), ''''))), ' + @CalcScript + ' from ' + @SQLSource + ' where 1=1 '
|
|
+ @AddWhere + ' group by ' + @ColFieldID + ', ' + @ColFieldName + ', ' + @ColFieldOrder
|
|
+ ' order by cast(ltrim(rtrim(isnull(' + @ColFieldOrder + ' , ''''))) as varchar(100))')
|
|
else
|
|
-- We are concerned with column ordering, and they must be sorted numerically
|
|
exec ('insert into #Columns (ColID, ColName, ColTotal)select ltrim(rtrim(isnull(cast('
|
|
+ @ColFieldID + ' as varchar(100)), ''''))), ltrim(rtrim(isnull(cast(' + @ColFieldName +
|
|
' as varchar(100)), ''''))), ' + @CalcScript + ' from ' + @SQLSource + ' where 1=1 '
|
|
+ @AddWhere + ' group by ' + @ColFieldID + ', ' + @ColFieldName + ', ' + @ColFieldOrder
|
|
+ ' order by cast(isnull(' + @ColFieldOrder + ' , 0) as decimal(24,8))')
|
|
end
|
|
|
|
|
|
-- If we've enabled both column and row totals, we'll need to add one extra cell to the
|
|
-- bottom corner that holds the grand total.
|
|
if @ColTotals is not null and
|
|
@RowTotals is not null
|
|
set @GrandTotal = 'cast(' + (select cast(sum(ColTotal) as varchar(100)) from #Columns) + ' as ' + @CalcFieldType + ')'
|
|
set @GrandTotal = isnull(@GrandTotal, '')
|
|
|
|
-----=====******--~-~--~~---~-~---~~-~-~---~---~--~--~~~-~-~---~---~--~*****=====-----
|
|
-- Strip the table names and/or aliases from the row fields
|
|
|
|
|
|
-- Things start to get interesting now. If we've used a portion of a SELECT statement as
|
|
-- our source data, it is possible that some of the fields in the @RowFieldNames param
|
|
-- are prefixed with either the table name or table alias. We need to strip these out,
|
|
-- so that we're left with the bare field name.
|
|
|
|
declare @StrippedField varchar(200)
|
|
declare @Index int
|
|
declare @Index2 int
|
|
declare @LastIndex int
|
|
declare @DeAliasedField varchar(200)
|
|
|
|
set @LastIndex = 1
|
|
set @Index = 9000
|
|
set @StrippedRowFieldNames = ''
|
|
set @DeAliasedField = ''
|
|
|
|
-- Loop through each row field
|
|
while @Index > 0
|
|
begin
|
|
|
|
set @Index = charindex(',', @RowFieldNames, @LastIndex)
|
|
|
|
if @Index = 0
|
|
set @StrippedField = ltrim(rtrim(substring(@RowFieldNames, @LastIndex, len(@RowFieldNames))))
|
|
else
|
|
set @StrippedField = ltrim(rtrim(substring(@RowFieldNames, @LastIndex, @Index - @LastIndex)))
|
|
|
|
|
|
-- Strip the alias for the outer query
|
|
set @Index2 = charindex('.', @StrippedField)
|
|
if @Index2 > 0
|
|
set @DeAliasedField = substring(@StrippedField, @Index2 + 1, len(@StrippedField))
|
|
else
|
|
set @DeAliasedField = @StrippedField
|
|
|
|
-- Append the stripped field name to our SELECT field list. Insert comma's where appropriate
|
|
set @StrippedRowFieldNames = @StrippedRowFieldNames + case len(@StrippedRowFieldNames) when 0 then '' else ',' end + @DeAliasedField
|
|
|
|
|
|
-- If the output of the cross tab is to be inserted into a given temp table, we'll need
|
|
-- to add the fields from @RowFieldNames into the temp table. This is also the start of
|
|
-- the 'debugging' outputs.
|
|
if @TempTableName is not null
|
|
begin
|
|
if @Debug = 1
|
|
print 'alter table ' + @TempTableName + ' add [' + @DeAliasedField + '] varchar(100)'
|
|
exec ('alter table ' + @TempTableName + ' add [' + @DeAliasedField + '] varchar(100)')
|
|
end
|
|
|
|
set @LastIndex = @Index + 1
|
|
end
|
|
|
|
|
|
-----=====******--~-~--~~---~-~---~~-~-~---~---~--~--~~~-~-~---~---~--~*****=====-----
|
|
-- Define column cursor
|
|
|
|
|
|
-- Right, we're now in the heart and soul of the stored procedure. Here we're going to
|
|
-- define a cursor that handles each column (already populated in the #Columns table)
|
|
-- in turn, and builds the CASE statement to catch the values that should be considered
|
|
-- when calculating that column.
|
|
|
|
-- Standard cursor declaration stuff
|
|
declare curColCursor cursor read_only for
|
|
select ColID, ColName, cast(ColTotal as varchar(100)) ColTotal
|
|
from #Columns
|
|
order by ColOrderNum
|
|
|
|
open curColCursor
|
|
|
|
fetch next
|
|
from curColCursor
|
|
into @ColID, @ColName, @ColTotal
|
|
|
|
while (@@fetch_status <> -1)
|
|
begin
|
|
if (@@fetch_status <> -2)
|
|
begin
|
|
|
|
-- If the field name is empty, we'll add a generic name for it. This would have
|
|
-- happened if we're using a @ColFieldName mapping, and a field name was not
|
|
-- found that linked to the @ColFieldID. These generic field names will run in
|
|
-- sequence; Field1, Field2 etc.
|
|
if @ColName = ''
|
|
set @ColName = 'Field ' + cast(@ColNo as varchar(50))
|
|
|
|
|
|
-- Add the column to the temp table
|
|
if @TempTableName is not null
|
|
begin
|
|
if @Debug = 1
|
|
print 'alter table ' + @TempTableName + ' add [' + @ColName + '] ' + @CalcFieldType
|
|
exec ('alter table ' + @TempTableName + ' add [' + @ColName + '] ' + @CalcFieldType)
|
|
end
|
|
|
|
|
|
-- Build the case statement for this column. This will form part of the 'inner' SELECT
|
|
set @SQLCaseLine = ', cast(case when ' + @ColFieldID + ' = ''' + cast(@ColID as varchar(50)) +
|
|
''' then isnull(' + @CalcOperation + '(' + @CalcFieldName + '), 0) else 0 end as ' +
|
|
@CalcFieldType + ') [' + @ColName + ']' + @NewLine
|
|
|
|
-- Build the statement to combine the individual entries into a proper cross tab. This
|
|
-- forms the SELECT field list of the 'outer' SELECT.
|
|
set @SQLColLine = ', sum([' + @ColName + ']) [' + @ColName + '] ' + @NewLine
|
|
|
|
-- Build up the column totals query
|
|
if @ColTotals is not null
|
|
set @SQLTtCLine = ', cast(' + @ColTotal + ' as ' + @CalcFieldType + ')'
|
|
|
|
-- Build up the row totals query
|
|
if @RowTotals is not null
|
|
begin
|
|
if (@SQLTotLen + @SQLTotLevel) > 1
|
|
set @SQLTotLine = ' + sum([' + @ColName + '])' + @NewLine
|
|
else
|
|
set @SQLTotLine = ' sum([' + @ColName + '])' + @NewLine
|
|
end
|
|
|
|
/*
|
|
if @RowTotals is not null
|
|
set @SQLTotLine = ' + sum([' + @ColName + '])' + @NewLine
|
|
*/
|
|
|
|
-- If we're saving the cross tab to a temp table, build up the temp
|
|
-- table INSERT query
|
|
if @TempTableName is not null
|
|
set @SQLInsLine = ', [' + @ColName + '] ' + @NewLine
|
|
|
|
|
|
-- Varchar's have a maximum length of 8000, and nvarchar's of 4000 (in SQL 2000, at least).
|
|
-- If we have a large number of columns, we'll exceed that length very quickly. Seeing that
|
|
-- we can't append all of this to a TEXT field, and have sp_executesql run from a TEXT type,
|
|
-- we'll need to find another workaround. I've basically declared a collection of varchar's
|
|
-- (I'm sure you didn't miss those at the beginning of the proc!). We'll keep appending data
|
|
-- to the variable we're currently working with, and once we're about to exceed it's capacity,
|
|
-- we'll switch to the next one in line. At the end, we concatenate all the strings together
|
|
-- and run it as one BIG statement. If you have inordinately large queries, and find that you
|
|
-- are running out of space, you'll need to add a few more of these 'buffer' variables. I
|
|
-- think that if you look at the code closely enough you'll figure out how to add a few more.
|
|
|
|
-- NB:!! If you want to use nvarchar's instead if varchars, you'll need to set @MaxVarSize
|
|
-- down to 4000. You should then also prefix all the strings with a 'N.
|
|
if len(@SQLCaseLine) + @SQLCaseLen > @MaxVarSize
|
|
begin
|
|
set @SQLCaseLine = '--*** Line ' + cast(@SQLCaseLevel as varchar(50)) + @NewLine + @SQLCaseLine
|
|
set @SQLCaseLevel = @SQLCaseLevel + 1
|
|
|
|
if @SQLCaseLevel > 50
|
|
raiserror ('Case level was too high (ran out of variables). %d', 16, 1, @SQLCaseLevel)
|
|
|
|
set @SQLCaseLen = 0
|
|
end
|
|
if len(@SQLColLine) + @SQLColLen > @MaxVarSize
|
|
begin
|
|
set @SQLColLevel = @SQLColLevel + 1
|
|
|
|
if @SQLColLevel > 50
|
|
raiserror ('Col level was too high (ran out of variables). %d', 16, 1, @SQLColLevel)
|
|
|
|
set @SQLColLen = 0
|
|
end
|
|
if len(@SQLTotLine) + @SQLTotLen > @MaxVarSize
|
|
begin
|
|
set @SQLTotLevel = @SQLTotLevel + 1
|
|
|
|
if @SQLTotLevel > 50
|
|
raiserror ('Tot level was too high (ran out of variables). %d', 16, 1, @SQLTotLevel)
|
|
|
|
set @SQLTotLen = 0
|
|
end
|
|
if len(@SQLTtCLine) + @SQLTtCLen > @MaxVarSize
|
|
begin
|
|
set @SQLTtCLevel = @SQLTtCLevel + 1
|
|
|
|
if @SQLTtCLevel > 50
|
|
raiserror ('Tot level was too high (ran out of variables). %d', 16, 1, @SQLTtCLevel)
|
|
|
|
set @SQLTtCLen = 0
|
|
end
|
|
if @TempTableName is not null
|
|
begin
|
|
if len(@SQLInsLine) + @SQLInsLen > @MaxVarSize
|
|
begin
|
|
set @SQLInsLevel = @SQLInsLevel + 1
|
|
|
|
if @SQLInsLevel > 30
|
|
raiserror ('Ins level was too high (ran out of variables). %d', 16, 1, @SQLInsLevel)
|
|
|
|
set @SQLInsLen = 0
|
|
end
|
|
end
|
|
|
|
-- Keep a running count of how full our current variable is
|
|
set @SQLCaseLen = @SQLCaseLen + len(@SQLCaseLine)
|
|
set @SQLColLen = @SQLColLen + len(@SQLColLine)
|
|
set @SQLTotLen = @SQLTotLen + len(@SQLTotLine)
|
|
set @SQLTtCLen = @SQLTtCLen + len(@SQLTtCLine)
|
|
if @TempTableName is not null
|
|
set @SQLInsLen = @SQLInsLen + len(@SQLInsLine)
|
|
|
|
|
|
-- Add the line to the appropriate column variable
|
|
if @SQLCaseLevel = 1 set @SQLCase1 = @SQLCase1 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 2 set @SQLCase2 = @SQLCase2 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 3 set @SQLCase3 = @SQLCase3 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 4 set @SQLCase4 = @SQLCase4 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 5 set @SQLCase5 = @SQLCase5 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 6 set @SQLCase6 = @SQLCase6 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 7 set @SQLCase7 = @SQLCase7 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 8 set @SQLCase8 = @SQLCase8 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 9 set @SQLCase9 = @SQLCase9 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 10 set @SQLCase10 = @SQLCase10 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 11 set @SQLCase11 = @SQLCase11 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 12 set @SQLCase12 = @SQLCase12 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 13 set @SQLCase13 = @SQLCase13 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 14 set @SQLCase14 = @SQLCase14 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 15 set @SQLCase15 = @SQLCase15 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 16 set @SQLCase16 = @SQLCase16 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 17 set @SQLCase17 = @SQLCase17 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 18 set @SQLCase18 = @SQLCase18 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 19 set @SQLCase19 = @SQLCase19 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 20 set @SQLCase20 = @SQLCase20 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 21 set @SQLCase21 = @SQLCase21 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 22 set @SQLCase22 = @SQLCase22 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 23 set @SQLCase23 = @SQLCase23 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 24 set @SQLCase24 = @SQLCase24 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 25 set @SQLCase25 = @SQLCase25 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 26 set @SQLCase26 = @SQLCase26 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 27 set @SQLCase27 = @SQLCase27 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 28 set @SQLCase28 = @SQLCase28 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 29 set @SQLCase29 = @SQLCase29 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 30 set @SQLCase30 = @SQLCase30 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 31 set @SQLCase31 = @SQLCase31 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 32 set @SQLCase32 = @SQLCase32 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 33 set @SQLCase33 = @SQLCase33 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 34 set @SQLCase34 = @SQLCase34 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 35 set @SQLCase35 = @SQLCase35 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 36 set @SQLCase36 = @SQLCase36 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 37 set @SQLCase37 = @SQLCase37 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 38 set @SQLCase38 = @SQLCase38 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 39 set @SQLCase39 = @SQLCase39 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 40 set @SQLCase40 = @SQLCase40 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 41 set @SQLCase41 = @SQLCase41 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 42 set @SQLCase42 = @SQLCase42 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 43 set @SQLCase43 = @SQLCase43 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 44 set @SQLCase44 = @SQLCase44 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 45 set @SQLCase45 = @SQLCase45 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 46 set @SQLCase46 = @SQLCase46 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 47 set @SQLCase47 = @SQLCase47 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 48 set @SQLCase48 = @SQLCase48 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 49 set @SQLCase49 = @SQLCase49 + @SQLCaseLine
|
|
else if @SQLCaseLevel = 50 set @SQLCase50 = @SQLCase50 + @SQLCaseLine
|
|
|
|
|
|
|
|
if @SQLColLevel = 1 set @SQLCol1 = @SQLCol1 + @SQLColLine
|
|
else if @SQLColLevel = 2 set @SQLCol2 = @SQLCol2 + @SQLColLine
|
|
else if @SQLColLevel = 3 set @SQLCol3 = @SQLCol3 + @SQLColLine
|
|
else if @SQLColLevel = 4 set @SQLCol4 = @SQLCol4 + @SQLColLine
|
|
else if @SQLColLevel = 5 set @SQLCol5 = @SQLCol5 + @SQLColLine
|
|
else if @SQLColLevel = 6 set @SQLCol6 = @SQLCol6 + @SQLColLine
|
|
else if @SQLColLevel = 7 set @SQLCol7 = @SQLCol7 + @SQLColLine
|
|
else if @SQLColLevel = 8 set @SQLCol8 = @SQLCol8 + @SQLColLine
|
|
else if @SQLColLevel = 9 set @SQLCol9 = @SQLCol9 + @SQLColLine
|
|
else if @SQLColLevel = 10 set @SQLCol10 = @SQLCol10 + @SQLColLine
|
|
else if @SQLColLevel = 11 set @SQLCol11 = @SQLCol11 + @SQLColLine
|
|
else if @SQLColLevel = 12 set @SQLCol12 = @SQLCol12 + @SQLColLine
|
|
else if @SQLColLevel = 13 set @SQLCol13 = @SQLCol13 + @SQLColLine
|
|
else if @SQLColLevel = 14 set @SQLCol14 = @SQLCol14 + @SQLColLine
|
|
else if @SQLColLevel = 15 set @SQLCol15 = @SQLCol15 + @SQLColLine
|
|
else if @SQLColLevel = 16 set @SQLCol16 = @SQLCol16 + @SQLColLine
|
|
else if @SQLColLevel = 17 set @SQLCol17 = @SQLCol17 + @SQLColLine
|
|
else if @SQLColLevel = 18 set @SQLCol18 = @SQLCol18 + @SQLColLine
|
|
else if @SQLColLevel = 19 set @SQLCol19 = @SQLCol19 + @SQLColLine
|
|
else if @SQLColLevel = 20 set @SQLCol20 = @SQLCol20 + @SQLColLine
|
|
else if @SQLColLevel = 21 set @SQLCol21 = @SQLCol21 + @SQLColLine
|
|
else if @SQLColLevel = 22 set @SQLCol22 = @SQLCol22 + @SQLColLine
|
|
else if @SQLColLevel = 23 set @SQLCol23 = @SQLCol23 + @SQLColLine
|
|
else if @SQLColLevel = 24 set @SQLCol24 = @SQLCol24 + @SQLColLine
|
|
else if @SQLColLevel = 25 set @SQLCol25 = @SQLCol25 + @SQLColLine
|
|
else if @SQLColLevel = 26 set @SQLCol26 = @SQLCol26 + @SQLColLine
|
|
else if @SQLColLevel = 27 set @SQLCol27 = @SQLCol27 + @SQLColLine
|
|
else if @SQLColLevel = 28 set @SQLCol28 = @SQLCol28 + @SQLColLine
|
|
else if @SQLColLevel = 29 set @SQLCol29 = @SQLCol29 + @SQLColLine
|
|
else if @SQLColLevel = 30 set @SQLCol30 = @SQLCol30 + @SQLColLine
|
|
else if @SQLColLevel = 31 set @SQLCol31 = @SQLCol31 + @SQLColLine
|
|
else if @SQLColLevel = 32 set @SQLCol32 = @SQLCol32 + @SQLColLine
|
|
else if @SQLColLevel = 33 set @SQLCol33 = @SQLCol33 + @SQLColLine
|
|
else if @SQLColLevel = 34 set @SQLCol34 = @SQLCol34 + @SQLColLine
|
|
else if @SQLColLevel = 35 set @SQLCol35 = @SQLCol35 + @SQLColLine
|
|
else if @SQLColLevel = 36 set @SQLCol36 = @SQLCol36 + @SQLColLine
|
|
else if @SQLColLevel = 37 set @SQLCol37 = @SQLCol37 + @SQLColLine
|
|
else if @SQLColLevel = 38 set @SQLCol38 = @SQLCol38 + @SQLColLine
|
|
else if @SQLColLevel = 39 set @SQLCol39 = @SQLCol39 + @SQLColLine
|
|
else if @SQLColLevel = 40 set @SQLCol40 = @SQLCol40 + @SQLColLine
|
|
else if @SQLColLevel = 41 set @SQLCol41 = @SQLCol41 + @SQLColLine
|
|
else if @SQLColLevel = 42 set @SQLCol42 = @SQLCol42 + @SQLColLine
|
|
else if @SQLColLevel = 43 set @SQLCol43 = @SQLCol43 + @SQLColLine
|
|
else if @SQLColLevel = 44 set @SQLCol44 = @SQLCol44 + @SQLColLine
|
|
else if @SQLColLevel = 45 set @SQLCol45 = @SQLCol45 + @SQLColLine
|
|
else if @SQLColLevel = 46 set @SQLCol46 = @SQLCol46 + @SQLColLine
|
|
else if @SQLColLevel = 47 set @SQLCol47 = @SQLCol47 + @SQLColLine
|
|
else if @SQLColLevel = 48 set @SQLCol48 = @SQLCol48 + @SQLColLine
|
|
else if @SQLColLevel = 49 set @SQLCol49 = @SQLCol49 + @SQLColLine
|
|
else if @SQLColLevel = 50 set @SQLCol50 = @SQLCol50 + @SQLColLine
|
|
|
|
if @RowTotals is not null
|
|
begin
|
|
if @SQLTotLevel = 1 set @SQLTot1 = @SQLTot1 + @SQLTotLine
|
|
else if @SQLTotLevel = 2 set @SQLTot2 = @SQLTot2 + @SQLTotLine
|
|
else if @SQLTotLevel = 3 set @SQLTot3 = @SQLTot3 + @SQLTotLine
|
|
else if @SQLTotLevel = 4 set @SQLTot4 = @SQLTot4 + @SQLTotLine
|
|
else if @SQLTotLevel = 5 set @SQLTot5 = @SQLTot5 + @SQLTotLine
|
|
else if @SQLTotLevel = 6 set @SQLTot6 = @SQLTot6 + @SQLTotLine
|
|
else if @SQLTotLevel = 7 set @SQLTot7 = @SQLTot7 + @SQLTotLine
|
|
else if @SQLTotLevel = 8 set @SQLTot8 = @SQLTot8 + @SQLTotLine
|
|
else if @SQLTotLevel = 9 set @SQLTot9 = @SQLTot9 + @SQLTotLine
|
|
else if @SQLTotLevel = 10 set @SQLTot10 = @SQLTot10 + @SQLTotLine
|
|
else if @SQLTotLevel = 11 set @SQLTot11 = @SQLTot11 + @SQLTotLine
|
|
else if @SQLTotLevel = 12 set @SQLTot12 = @SQLTot12 + @SQLTotLine
|
|
else if @SQLTotLevel = 13 set @SQLTot13 = @SQLTot13 + @SQLTotLine
|
|
else if @SQLTotLevel = 14 set @SQLTot14 = @SQLTot14 + @SQLTotLine
|
|
else if @SQLTotLevel = 15 set @SQLTot15 = @SQLTot15 + @SQLTotLine
|
|
else if @SQLTotLevel = 16 set @SQLTot16 = @SQLTot16 + @SQLTotLine
|
|
else if @SQLTotLevel = 17 set @SQLTot17 = @SQLTot17 + @SQLTotLine
|
|
else if @SQLTotLevel = 18 set @SQLTot18 = @SQLTot18 + @SQLTotLine
|
|
else if @SQLTotLevel = 19 set @SQLTot19 = @SQLTot19 + @SQLTotLine
|
|
else if @SQLTotLevel = 20 set @SQLTot20 = @SQLTot20 + @SQLTotLine
|
|
else if @SQLTotLevel = 21 set @SQLTot21 = @SQLTot21 + @SQLTotLine
|
|
else if @SQLTotLevel = 22 set @SQLTot22 = @SQLTot22 + @SQLTotLine
|
|
else if @SQLTotLevel = 23 set @SQLTot23 = @SQLTot23 + @SQLTotLine
|
|
else if @SQLTotLevel = 24 set @SQLTot24 = @SQLTot24 + @SQLTotLine
|
|
else if @SQLTotLevel = 25 set @SQLTot25 = @SQLTot25 + @SQLTotLine
|
|
else if @SQLTotLevel = 26 set @SQLTot26 = @SQLTot26 + @SQLTotLine
|
|
else if @SQLTotLevel = 27 set @SQLTot27 = @SQLTot27 + @SQLTotLine
|
|
else if @SQLTotLevel = 28 set @SQLTot28 = @SQLTot28 + @SQLTotLine
|
|
else if @SQLTotLevel = 29 set @SQLTot29 = @SQLTot29 + @SQLTotLine
|
|
else if @SQLTotLevel = 30 set @SQLTot30 = @SQLTot30 + @SQLTotLine
|
|
else if @SQLTotLevel = 31 set @SQLTot31 = @SQLTot31 + @SQLTotLine
|
|
else if @SQLTotLevel = 32 set @SQLTot32 = @SQLTot32 + @SQLTotLine
|
|
else if @SQLTotLevel = 33 set @SQLTot33 = @SQLTot33 + @SQLTotLine
|
|
else if @SQLTotLevel = 34 set @SQLTot34 = @SQLTot34 + @SQLTotLine
|
|
else if @SQLTotLevel = 35 set @SQLTot35 = @SQLTot35 + @SQLTotLine
|
|
else if @SQLTotLevel = 36 set @SQLTot36 = @SQLTot36 + @SQLTotLine
|
|
else if @SQLTotLevel = 37 set @SQLTot37 = @SQLTot37 + @SQLTotLine
|
|
else if @SQLTotLevel = 38 set @SQLTot38 = @SQLTot38 + @SQLTotLine
|
|
else if @SQLTotLevel = 39 set @SQLTot39 = @SQLTot39 + @SQLTotLine
|
|
else if @SQLTotLevel = 40 set @SQLTot40 = @SQLTot40 + @SQLTotLine
|
|
else if @SQLTotLevel = 41 set @SQLTot41 = @SQLTot41 + @SQLTotLine
|
|
else if @SQLTotLevel = 42 set @SQLTot42 = @SQLTot42 + @SQLTotLine
|
|
else if @SQLTotLevel = 43 set @SQLTot43 = @SQLTot43 + @SQLTotLine
|
|
else if @SQLTotLevel = 44 set @SQLTot44 = @SQLTot44 + @SQLTotLine
|
|
else if @SQLTotLevel = 45 set @SQLTot45 = @SQLTot45 + @SQLTotLine
|
|
else if @SQLTotLevel = 46 set @SQLTot46 = @SQLTot46 + @SQLTotLine
|
|
else if @SQLTotLevel = 47 set @SQLTot47 = @SQLTot47 + @SQLTotLine
|
|
else if @SQLTotLevel = 48 set @SQLTot48 = @SQLTot48 + @SQLTotLine
|
|
else if @SQLTotLevel = 49 set @SQLTot49 = @SQLTot49 + @SQLTotLine
|
|
else if @SQLTotLevel = 50 set @SQLTot50 = @SQLTot50 + @SQLTotLine
|
|
end
|
|
|
|
if @TempTableName is not null
|
|
begin
|
|
if @SQLInsLevel = 1 set @SQLIns1 = @SQLIns1 + @SQLInsLine
|
|
else if @SQLInsLevel = 2 set @SQLIns2 = @SQLIns2 + @SQLInsLine
|
|
else if @SQLInsLevel = 3 set @SQLIns3 = @SQLIns3 + @SQLInsLine
|
|
else if @SQLInsLevel = 4 set @SQLIns4 = @SQLIns4 + @SQLInsLine
|
|
else if @SQLInsLevel = 5 set @SQLIns5 = @SQLIns5 + @SQLInsLine
|
|
else if @SQLInsLevel = 6 set @SQLIns6 = @SQLIns6 + @SQLInsLine
|
|
else if @SQLInsLevel = 7 set @SQLIns7 = @SQLIns7 + @SQLInsLine
|
|
else if @SQLInsLevel = 8 set @SQLIns8 = @SQLIns8 + @SQLInsLine
|
|
else if @SQLInsLevel = 9 set @SQLIns9 = @SQLIns9 + @SQLInsLine
|
|
else if @SQLInsLevel = 10 set @SQLIns10 = @SQLIns10 + @SQLInsLine
|
|
else if @SQLInsLevel = 11 set @SQLIns11 = @SQLIns11 + @SQLInsLine
|
|
else if @SQLInsLevel = 12 set @SQLIns12 = @SQLIns12 + @SQLInsLine
|
|
else if @SQLInsLevel = 13 set @SQLIns13 = @SQLIns13 + @SQLInsLine
|
|
else if @SQLInsLevel = 14 set @SQLIns14 = @SQLIns14 + @SQLInsLine
|
|
else if @SQLInsLevel = 15 set @SQLIns15 = @SQLIns15 + @SQLInsLine
|
|
else if @SQLInsLevel = 16 set @SQLIns16 = @SQLIns16 + @SQLInsLine
|
|
else if @SQLInsLevel = 17 set @SQLIns17 = @SQLIns17 + @SQLInsLine
|
|
else if @SQLInsLevel = 18 set @SQLIns18 = @SQLIns18 + @SQLInsLine
|
|
else if @SQLInsLevel = 19 set @SQLIns19 = @SQLIns19 + @SQLInsLine
|
|
else if @SQLInsLevel = 20 set @SQLIns20 = @SQLIns20 + @SQLInsLine
|
|
else if @SQLInsLevel = 21 set @SQLIns21 = @SQLIns21 + @SQLInsLine
|
|
else if @SQLInsLevel = 22 set @SQLIns22 = @SQLIns22 + @SQLInsLine
|
|
else if @SQLInsLevel = 23 set @SQLIns23 = @SQLIns23 + @SQLInsLine
|
|
else if @SQLInsLevel = 24 set @SQLIns24 = @SQLIns24 + @SQLInsLine
|
|
else if @SQLInsLevel = 25 set @SQLIns25 = @SQLIns25 + @SQLInsLine
|
|
else if @SQLInsLevel = 26 set @SQLIns26 = @SQLIns26 + @SQLInsLine
|
|
else if @SQLInsLevel = 27 set @SQLIns27 = @SQLIns27 + @SQLInsLine
|
|
else if @SQLInsLevel = 28 set @SQLIns28 = @SQLIns28 + @SQLInsLine
|
|
else if @SQLInsLevel = 29 set @SQLIns29 = @SQLIns29 + @SQLInsLine
|
|
else if @SQLInsLevel = 30 set @SQLIns30 = @SQLIns30 + @SQLInsLine
|
|
end
|
|
|
|
if @ColTotals is not null
|
|
begin
|
|
if @SQLTtCLevel = 1 set @SQLTtC1 = @SQLTtC1 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 2 set @SQLTtC2 = @SQLTtC2 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 3 set @SQLTtC3 = @SQLTtC3 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 4 set @SQLTtC4 = @SQLTtC4 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 5 set @SQLTtC5 = @SQLTtC5 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 6 set @SQLTtC6 = @SQLTtC6 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 7 set @SQLTtC7 = @SQLTtC7 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 8 set @SQLTtC8 = @SQLTtC8 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 9 set @SQLTtC9 = @SQLTtC9 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 10 set @SQLTtC10 = @SQLTtC10 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 11 set @SQLTtC11 = @SQLTtC11 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 12 set @SQLTtC12 = @SQLTtC12 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 13 set @SQLTtC13 = @SQLTtC13 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 14 set @SQLTtC14 = @SQLTtC14 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 15 set @SQLTtC15 = @SQLTtC15 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 16 set @SQLTtC16 = @SQLTtC16 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 17 set @SQLTtC17 = @SQLTtC17 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 18 set @SQLTtC18 = @SQLTtC18 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 19 set @SQLTtC19 = @SQLTtC19 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 20 set @SQLTtC20 = @SQLTtC20 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 21 set @SQLTtC21 = @SQLTtC21 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 22 set @SQLTtC22 = @SQLTtC22 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 23 set @SQLTtC23 = @SQLTtC23 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 24 set @SQLTtC24 = @SQLTtC24 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 25 set @SQLTtC25 = @SQLTtC25 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 26 set @SQLTtC26 = @SQLTtC26 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 27 set @SQLTtC27 = @SQLTtC27 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 28 set @SQLTtC28 = @SQLTtC28 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 29 set @SQLTtC29 = @SQLTtC29 + @SQLTtCLine
|
|
else if @SQLTtCLevel = 30 set @SQLTtC30 = @SQLTtC30 + @SQLTtCLine
|
|
end
|
|
|
|
set @ColNo = @ColNo + 1
|
|
|
|
end
|
|
|
|
fetch next
|
|
from curColCursor
|
|
into @ColID, @ColName, @ColTotal
|
|
|
|
end
|
|
|
|
close curColCursor
|
|
deallocate curColCursor
|
|
|
|
-- Don't forget to debug print our row total column...
|
|
if @RowTotals is not null and
|
|
@TempTableName is not null
|
|
begin
|
|
if @Debug = 1
|
|
print 'alter table ' + @TempTableName + ' add [' + @RowTotals + '] ' + @CalcFieldType
|
|
exec ('alter table ' + @TempTableName + ' add [' + @RowTotals + '] ' + @CalcFieldType)
|
|
end
|
|
|
|
|
|
-----=====******--~-~--~~---~-~---~~-~-~---~---~--~--~~~-~-~---~---~--~*****=====-----
|
|
-- Run the cross-tab
|
|
|
|
-- Right, all the hard work has now been done. We just need to run the SQL statements
|
|
-- that we've built up. We have eight different scenarions (a combination of with or
|
|
-- without column totals, with or without row totals, and with or without writing to
|
|
-- a temp table). The query execution for each of these scenarios differs slightly.
|
|
-- I probably could have joined some of these scenarios, but the decided against it
|
|
-- for both performance and maintainability reasons. If does look a bit full though
|
|
-- with all the debug code mixed in with it.
|
|
|
|
|
|
|
|
if @ColTotals is not null
|
|
begin
|
|
if @RowTotals is not null
|
|
begin
|
|
if @TempTableName is not null
|
|
begin -- Row totals, col totals, temp table
|
|
if @Debug = 1
|
|
begin
|
|
print '--1 Row totals, col totals, temp table'
|
|
print 'insert into ' + @TempTableName + '(' + @StrippedRowFieldNames
|
|
print @SQLIns1 print @SQLIns2 print @SQLIns3 print @SQLIns4 print @SQLIns5 print @SQLIns6 print @SQLIns7
|
|
print @SQLIns8 print @SQLIns9 print @SQLIns10 print @SQLIns11 print @SQLIns12 print @SQLIns13 print @SQLIns14
|
|
print @SQLIns15 print @SQLIns16 print @SQLIns17 print @SQLIns18 print @SQLIns19 print @SQLIns20 print @SQLIns21
|
|
print @SQLIns22 print @SQLIns23 print @SQLIns24 print @SQLIns25 print @SQLIns26 print @SQLIns27 print @SQLIns28
|
|
print @SQLIns29 print @SQLIns30 print ',[' + @RowTotals + '])' print 'select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print @NewLine + ', '
|
|
print @SQLTot1 print @SQLTot2 print @SQLTot3 print @SQLTot4 print @SQLTot5 print @SQLTot6 print @SQLTot7
|
|
print @SQLTot8 print @SQLTot9 print @SQLTot10 print @SQLTot11 print @SQLTot12 print @SQLTot13 print @SQLTot14
|
|
print @SQLTot15 print @SQLTot16 print @SQLTot17 print @SQLTot18 print @SQLTot19 print @SQLTot20 print @SQLTot21
|
|
print @SQLTot22 print @SQLTot23 print @SQLTot24 print @SQLTot25 print @SQLTot26 print @SQLTot27 print @SQLTot28
|
|
print @SQLTot29 print @SQLTot30 print @SQLTot31 print @SQLTot32 print @SQLTot33 print @SQLTot34 print @SQLTot35
|
|
print @SQLTot36 print @SQLTot37 print @SQLTot38 print @SQLTot39 print @SQLTot40 print @SQLTot41 print @SQLTot42
|
|
print @SQLTot43 print @SQLTot44 print @SQLTot45 print @SQLTot46 print @SQLTot47 print @SQLTot48 print @SQLTot49
|
|
print @SQLTot50 print ' [' + @RowTotals + ']' + @NewLine print @NewLine + ' from (select ' + @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine
|
|
print 'union all ' + @Newline + 'select ' + @ColTotals
|
|
print @SQLTtC1 print @SQLTtC2 print @SQLTtC3 print @SQLTtC4 print @SQLTtC5 print @SQLTtC6 print @SQLTtC7
|
|
print @SQLTtC8 print @SQLTtC9 print @SQLTtC10 print @SQLTtC11 print @SQLTtC12 print @SQLTtC13 print @SQLTtC14
|
|
print @SQLTtC15 print @SQLTtC16 print @SQLTtC17 print @SQLTtC18 print @SQLTtC19 print @SQLTtC20 print @SQLTtC21
|
|
print @SQLTtC22 print @SQLTtC23 print @SQLTtC24 print @SQLTtC25 print @SQLTtC26 print @SQLTtC27 print @SQLTtC28
|
|
print @SQLTtC29 print @SQLTtC30 print ', ' + @GrandTotal print @AddOrder + @NewLine
|
|
end
|
|
|
|
exec ('insert into ' + @TempTableName + '(' + @StrippedRowFieldNames +
|
|
@SQLIns1 + @SQLIns2 + @SQLIns3 + @SQLIns4 + @SQLIns5 + @SQLIns6 + @SQLIns7 + @SQLIns8 + @SQLIns9 + @SQLIns10 +
|
|
@SQLIns11 + @SQLIns12 + @SQLIns13 + @SQLIns14 + @SQLIns15 + @SQLIns16 + @SQLIns17 + @SQLIns18 + @SQLIns19 + @SQLIns20 +
|
|
@SQLIns21 + @SQLIns22 + @SQLIns23 + @SQLIns24 + @SQLIns25 + @SQLIns26 + @SQLIns27 + @SQLIns28 + @SQLIns29 + @SQLIns30 +
|
|
',[' + @RowTotals + '])' +
|
|
'select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ', ' +
|
|
@SQLTot1 + @SQLTot2 + @SQLTot3 + @SQLTot4 + @SQLTot5 + @SQLTot6 + @SQLTot7 + @SQLTot8 + @SQLTot9 + @SQLTot10 +
|
|
@SQLTot11 + @SQLTot12 + @SQLTot13 + @SQLTot14 + @SQLTot15 + @SQLTot16 + @SQLTot17 + @SQLTot18 + @SQLTot19 + @SQLTot20 +
|
|
@SQLTot21 + @SQLTot22 + @SQLTot23 + @SQLTot24 + @SQLTot25 + @SQLTot26 + @SQLTot27 + @SQLTot28 + @SQLTot29 + @SQLTot30 +
|
|
@SQLTot31 + @SQLTot32 + @SQLTot33 + @SQLTot34 + @SQLTot35 + @SQLTot36 + @SQLTot37 + @SQLTot38 + @SQLTot39 + @SQLTot40 +
|
|
@SQLTot41 + @SQLTot42 + @SQLTot43 + @SQLTot44 + @SQLTot45 + @SQLTot46 + @SQLTot47 + @SQLTot48 + @SQLTot49 + @SQLTot50 +
|
|
' [' + @RowTotals + ']' + @NewLine +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine +
|
|
' union all ' + @Newline + 'select ' + @ColTotals +
|
|
@SQLTtC1 + @SQLTtC2 + @SQLTtC3 + @SQLTtC4 + @SQLTtC5 + @SQLTtC6 + @SQLTtC7 + @SQLTtC8 + @SQLTtC9 + @SQLTtC10 +
|
|
@SQLTtC11 + @SQLTtC12 + @SQLTtC13 + @SQLTtC14 + @SQLTtC15 + @SQLTtC16 + @SQLTtC17 + @SQLTtC18 + @SQLTtC19 + @SQLTtC20 +
|
|
@SQLTtC21 + @SQLTtC22 + @SQLTtC23 + @SQLTtC24 + @SQLTtC25 + @SQLTtC26 + @SQLTtC27 + @SQLTtC28 + @SQLTtC29 + @SQLTtC30 +
|
|
', ' + @GrandTotal + @AddOrder
|
|
)
|
|
end
|
|
else
|
|
begin -- Row totals, col totals, no temp table
|
|
if @Debug = 1
|
|
begin
|
|
print 'select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print @NewLine + ', '
|
|
print @SQLTot1 print @SQLTot2 print @SQLTot3 print @SQLTot4 print @SQLTot5 print @SQLTot6 print @SQLTot7
|
|
print @SQLTot8 print @SQLTot9 print @SQLTot10 print @SQLTot11 print @SQLTot12 print @SQLTot13 print @SQLTot14
|
|
print @SQLTot15 print @SQLTot16 print @SQLTot17 print @SQLTot18 print @SQLTot19 print @SQLTot20 print @SQLTot21
|
|
print @SQLTot22 print @SQLTot23 print @SQLTot24 print @SQLTot25 print @SQLTot26 print @SQLTot27 print @SQLTot28
|
|
print @SQLTot29 print @SQLTot30 print @SQLTot31 print @SQLTot32 print @SQLTot33 print @SQLTot34 print @SQLTot35
|
|
print @SQLTot36 print @SQLTot37 print @SQLTot38 print @SQLTot39 print @SQLTot40 print @SQLTot41 print @SQLTot42
|
|
print @SQLTot43 print @SQLTot44 print @SQLTot45 print @SQLTot46 print @SQLTot47 print @SQLTot48 print @SQLTot49
|
|
print @SQLTot50 print ' [' + @RowTotals + ']' + @NewLine print @NewLine + ' from (select ' + @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine
|
|
print 'union all ' + @Newline + 'select ' + @ColTotals
|
|
print @SQLTtC1 print @SQLTtC2 print @SQLTtC3 print @SQLTtC4 print @SQLTtC5 print @SQLTtC6 print @SQLTtC7
|
|
print @SQLTtC8 print @SQLTtC9 print @SQLTtC10 print @SQLTtC11 print @SQLTtC12 print @SQLTtC13 print @SQLTtC14
|
|
print @SQLTtC15 print @SQLTtC16 print @SQLTtC17 print @SQLTtC18 print @SQLTtC19 print @SQLTtC20 print @SQLTtC21
|
|
print @SQLTtC22 print @SQLTtC23 print @SQLTtC24 print @SQLTtC25 print @SQLTtC26 print @SQLTtC27 print @SQLTtC28
|
|
print @SQLTtC29 print @SQLTtC30 print ', ' + @GrandTotal print @AddOrder + @NewLine
|
|
end
|
|
|
|
exec ('select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ', ' +
|
|
@SQLTot1 + @SQLTot2 + @SQLTot3 + @SQLTot4 + @SQLTot5 + @SQLTot6 + @SQLTot7 + @SQLTot8 + @SQLTot9 + @SQLTot10 +
|
|
@SQLTot11 + @SQLTot12 + @SQLTot13 + @SQLTot14 + @SQLTot15 + @SQLTot16 + @SQLTot17 + @SQLTot18 + @SQLTot19 + @SQLTot20 +
|
|
@SQLTot21 + @SQLTot22 + @SQLTot23 + @SQLTot24 + @SQLTot25 + @SQLTot26 + @SQLTot27 + @SQLTot28 + @SQLTot29 + @SQLTot30 +
|
|
@SQLTot31 + @SQLTot32 + @SQLTot33 + @SQLTot34 + @SQLTot35 + @SQLTot36 + @SQLTot37 + @SQLTot38 + @SQLTot39 + @SQLTot40 +
|
|
@SQLTot41 + @SQLTot42 + @SQLTot43 + @SQLTot44 + @SQLTot45 + @SQLTot46 + @SQLTot47 + @SQLTot48 + @SQLTot49 + @SQLTot50 +
|
|
' [' + @RowTotals + ']' + @NewLine +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine +
|
|
' union all ' + @Newline + 'select ' + @ColTotals +
|
|
@SQLTtC1 + @SQLTtC2 + @SQLTtC3 + @SQLTtC4 + @SQLTtC5 + @SQLTtC6 + @SQLTtC7 + @SQLTtC8 + @SQLTtC9 + @SQLTtC10 +
|
|
@SQLTtC11 + @SQLTtC12 + @SQLTtC13 + @SQLTtC14 + @SQLTtC15 + @SQLTtC16 + @SQLTtC17 + @SQLTtC18 + @SQLTtC19 + @SQLTtC20 +
|
|
@SQLTtC21 + @SQLTtC22 + @SQLTtC23 + @SQLTtC24 + @SQLTtC25 + @SQLTtC26 + @SQLTtC27 + @SQLTtC28 + @SQLTtC29 + @SQLTtC30 +
|
|
', ' + @GrandTotal + @AddOrder
|
|
)
|
|
end
|
|
end
|
|
else
|
|
begin
|
|
if @TempTableName is not null
|
|
begin -- No row totals, col totals, temp table
|
|
if @Debug = 1
|
|
begin
|
|
print '--3 No row totals, col totals, temp table'
|
|
print 'insert into ' + @TempTableName + '(' + @StrippedRowFieldNames
|
|
print @SQLIns1 print @SQLIns2 print @SQLIns3 print @SQLIns4 print @SQLIns5 print @SQLIns6 print @SQLIns7
|
|
print @SQLIns8 print @SQLIns9 print @SQLIns10 print @SQLIns11 print @SQLIns12 print @SQLIns13 print @SQLIns14
|
|
print @SQLIns15 print @SQLIns16 print @SQLIns17 print @SQLIns18 print @SQLIns19 print @SQLIns20 print @SQLIns21
|
|
print @SQLIns22 print @SQLIns23 print @SQLIns24 print @SQLIns25 print @SQLIns26 print @SQLIns27 print @SQLIns28
|
|
print @SQLIns29 print @SQLIns30 print ') select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print ' from (select ' print @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine
|
|
print 'union all ' + @Newline + 'select ' + @ColTotals
|
|
print @SQLTtC1 print @SQLTtC2 print @SQLTtC3 print @SQLTtC4 print @SQLTtC5 print @SQLTtC6 print @SQLTtC7
|
|
print @SQLTtC8 print @SQLTtC9 print @SQLTtC10 print @SQLTtC11 print @SQLTtC12 print @SQLTtC13 print @SQLTtC14
|
|
print @SQLTtC15 print @SQLTtC16 print @SQLTtC17 print @SQLTtC18 print @SQLTtC19 print @SQLTtC20 print @SQLTtC21
|
|
print @SQLTtC22 print @SQLTtC23 print @SQLTtC24 print @SQLTtC25 print @SQLTtC26 print @SQLTtC27 print @SQLTtC28
|
|
print @SQLTtC29 print @SQLTtC30 print @AddOrder + @NewLine
|
|
end
|
|
|
|
exec ('insert into ' + @TempTableName + '(' + @StrippedRowFieldNames +
|
|
@SQLIns1 + @SQLIns2 + @SQLIns3 + @SQLIns4 + @SQLIns5 + @SQLIns6 + @SQLIns7 + @SQLIns8 + @SQLIns9 + @SQLIns10 +
|
|
@SQLIns11 + @SQLIns12 + @SQLIns13 + @SQLIns14 + @SQLIns15 + @SQLIns16 + @SQLIns17 + @SQLIns18 + @SQLIns19 + @SQLIns20 +
|
|
@SQLIns21 + @SQLIns22 + @SQLIns23 + @SQLIns24 + @SQLIns25 + @SQLIns26 + @SQLIns27 + @SQLIns28 + @SQLIns29 + @SQLIns30 + ')' +
|
|
'select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine +
|
|
' union all ' + @Newline + 'select ' + @ColTotals +
|
|
@SQLTtC1 + @SQLTtC2 + @SQLTtC3 + @SQLTtC4 + @SQLTtC5 + @SQLTtC6 + @SQLTtC7 + @SQLTtC8 + @SQLTtC9 + @SQLTtC10 +
|
|
@SQLTtC11 + @SQLTtC12 + @SQLTtC13 + @SQLTtC14 + @SQLTtC15 + @SQLTtC16 + @SQLTtC17 + @SQLTtC18 + @SQLTtC19 + @SQLTtC20 +
|
|
@SQLTtC21 + @SQLTtC22 + @SQLTtC23 + @SQLTtC24 + @SQLTtC25 + @SQLTtC26 + @SQLTtC27 + @SQLTtC28 + @SQLTtC29 + @SQLTtC30 +
|
|
@AddOrder
|
|
)
|
|
end
|
|
else
|
|
begin -- No row totals, col totals, no temp table
|
|
if @Debug = 1
|
|
begin
|
|
print '--4 No row totals, col totals, no temp table'
|
|
print 'select * from (select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print @NewLine + ' from (select ' + @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine
|
|
print 'union all ' + @Newline + 'select ' + @ColTotals
|
|
print @SQLTtC1 print @SQLTtC2 print @SQLTtC3 print @SQLTtC4 print @SQLTtC5 print @SQLTtC6 print @SQLTtC7
|
|
print @SQLTtC8 print @SQLTtC9 print @SQLTtC10 print @SQLTtC11 print @SQLTtC12 print @SQLTtC13 print @SQLTtC14
|
|
print @SQLTtC15 print @SQLTtC16 print @SQLTtC17 print @SQLTtC18 print @SQLTtC19 print @SQLTtC20 print @SQLTtC21
|
|
print @SQLTtC22 print @SQLTtC23 print @SQLTtC24 print @SQLTtC25 print @SQLTtC26 print @SQLTtC27 print @SQLTtC28
|
|
print @SQLTtC29 print @SQLTtC30 print ' ) X ' + @AddOrder + @NewLine
|
|
end
|
|
|
|
exec ('select * from (select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine +
|
|
' union all ' + @Newline + 'select ' + @ColTotals +
|
|
@SQLTtC1 + @SQLTtC2 + @SQLTtC3 + @SQLTtC4 + @SQLTtC5 + @SQLTtC6 + @SQLTtC7 + @SQLTtC8 + @SQLTtC9 + @SQLTtC10 +
|
|
@SQLTtC11 + @SQLTtC12 + @SQLTtC13 + @SQLTtC14 + @SQLTtC15 + @SQLTtC16 + @SQLTtC17 + @SQLTtC18 + @SQLTtC19 + @SQLTtC20 +
|
|
@SQLTtC21 + @SQLTtC22 + @SQLTtC23 + @SQLTtC24 + @SQLTtC25 + @SQLTtC26 + @SQLTtC27 + @SQLTtC28 + @SQLTtC29 + @SQLTtC30 +
|
|
' ) X ' + @AddOrder + @NewLine
|
|
)
|
|
end
|
|
end
|
|
end
|
|
else
|
|
begin
|
|
if @RowTotals is not null
|
|
begin
|
|
if @TempTableName is not null
|
|
begin -- Row totals, no col totals, temp table
|
|
if @Debug = 1
|
|
begin
|
|
print '--5 Row totals, no col totals, temp table'
|
|
print 'insert into ' + @TempTableName + '(' + @StrippedRowFieldNames
|
|
print @SQLIns1 print @SQLIns2 print @SQLIns3 print @SQLIns4 print @SQLIns5 print @SQLIns6 print @SQLIns7
|
|
print @SQLIns8 print @SQLIns9 print @SQLIns10 print @SQLIns11 print @SQLIns12 print @SQLIns13 print @SQLIns14
|
|
print @SQLIns15 print @SQLIns16 print @SQLIns17 print @SQLIns18 print @SQLIns19 print @SQLIns20 print @SQLIns21
|
|
print @SQLIns22 print @SQLIns23 print @SQLIns24 print @SQLIns25 print @SQLIns26 print @SQLIns27 print @SQLIns28
|
|
print @SQLIns29 print @SQLIns30 print ', [' + @RowTotals + '])' print 'select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print @NewLine + ', '
|
|
print @SQLTot1 print @SQLTot2 print @SQLTot3 print @SQLTot4 print @SQLTot5 print @SQLTot6 print @SQLTot7
|
|
print @SQLTot8 print @SQLTot9 print @SQLTot10 print @SQLTot11 print @SQLTot12 print @SQLTot13 print @SQLTot14
|
|
print @SQLTot15 print @SQLTot16 print @SQLTot17 print @SQLTot18 print @SQLTot19 print @SQLTot20 print @SQLTot21
|
|
print @SQLTot22 print @SQLTot23 print @SQLTot24 print @SQLTot25 print @SQLTot26 print @SQLTot27 print @SQLTot28
|
|
print @SQLTot29 print @SQLTot30 print @SQLTot31 print @SQLTot32 print @SQLTot33 print @SQLTot34 print @SQLTot35
|
|
print @SQLTot36 print @SQLTot37 print @SQLTot38 print @SQLTot39 print @SQLTot40 print @SQLTot41 print @SQLTot42
|
|
print @SQLTot43 print @SQLTot44 print @SQLTot45 print @SQLTot46 print @SQLTot47 print @SQLTot48 print @SQLTot49
|
|
print @SQLTot50 print ' [' + @RowTotals + ']' + @NewLine print @NewLine + ' from (select ' + @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
end
|
|
|
|
exec ('insert into ' + @TempTableName + '(' + @StrippedRowFieldNames +
|
|
@SQLIns1 + @SQLIns2 + @SQLIns3 + @SQLIns4 + @SQLIns5 + @SQLIns6 + @SQLIns7 + @SQLIns8 + @SQLIns9 + @SQLIns10 +
|
|
@SQLIns11 + @SQLIns12 + @SQLIns13 + @SQLIns14 + @SQLIns15 + @SQLIns16 + @SQLIns17 + @SQLIns18 + @SQLIns19 + @SQLIns20 +
|
|
@SQLIns21 + @SQLIns22 + @SQLIns23 + @SQLIns24 + @SQLIns25 + @SQLIns26 + @SQLIns27 + @SQLIns28 + @SQLIns29 + @SQLIns30 +
|
|
', [' + @RowTotals + '])' +
|
|
'select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ', ' +
|
|
@SQLTot1 + @SQLTot2 + @SQLTot3 + @SQLTot4 + @SQLTot5 + @SQLTot6 + @SQLTot7 + @SQLTot8 + @SQLTot9 + @SQLTot10 +
|
|
@SQLTot11 + @SQLTot12 + @SQLTot13 + @SQLTot14 + @SQLTot15 + @SQLTot16 + @SQLTot17 + @SQLTot18 + @SQLTot19 + @SQLTot20 +
|
|
@SQLTot21 + @SQLTot22 + @SQLTot23 + @SQLTot24 + @SQLTot25 + @SQLTot26 + @SQLTot27 + @SQLTot28 + @SQLTot29 + @SQLTot30 +
|
|
@SQLTot31 + @SQLTot32 + @SQLTot33 + @SQLTot34 + @SQLTot35 + @SQLTot36 + @SQLTot37 + @SQLTot38 + @SQLTot39 + @SQLTot40 +
|
|
@SQLTot41 + @SQLTot42 + @SQLTot43 + @SQLTot44 + @SQLTot45 + @SQLTot46 + @SQLTot47 + @SQLTot48 + @SQLTot49 + @SQLTot50 +
|
|
' [' + @RowTotals + ']' + @NewLine +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
)
|
|
end
|
|
else
|
|
begin -- Row totals, no col totals, no temp table
|
|
if @Debug = 1
|
|
begin
|
|
print '--6 Row totals, no col totals, no temp table'
|
|
print 'select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print @NewLine + ', '
|
|
print @SQLTot1 print @SQLTot2 print @SQLTot3 print @SQLTot4 print @SQLTot5 print @SQLTot6 print @SQLTot7
|
|
print @SQLTot8 print @SQLTot9 print @SQLTot10 print @SQLTot11 print @SQLTot12 print @SQLTot13 print @SQLTot14
|
|
print @SQLTot15 print @SQLTot16 print @SQLTot17 print @SQLTot18 print @SQLTot19 print @SQLTot20 print @SQLTot21
|
|
print @SQLTot22 print @SQLTot23 print @SQLTot24 print @SQLTot25 print @SQLTot26 print @SQLTot27 print @SQLTot28
|
|
print @SQLTot29 print @SQLTot30 print @SQLTot31 print @SQLTot32 print @SQLTot33 print @SQLTot34 print @SQLTot35
|
|
print @SQLTot36 print @SQLTot37 print @SQLTot38 print @SQLTot39 print @SQLTot40 print @SQLTot41 print @SQLTot42
|
|
print @SQLTot43 print @SQLTot44 print @SQLTot45 print @SQLTot46 print @SQLTot47 print @SQLTot48 print @SQLTot49
|
|
print @SQLTot50 print ' [' + @RowTotals + ']' + @NewLine print @NewLine + ' from (select ' + @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
end
|
|
|
|
exec ('select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ', ' +
|
|
@SQLTot1 + @SQLTot2 + @SQLTot3 + @SQLTot4 + @SQLTot5 + @SQLTot6 + @SQLTot7 + @SQLTot8 + @SQLTot9 + @SQLTot10 +
|
|
@SQLTot11 + @SQLTot12 + @SQLTot13 + @SQLTot14 + @SQLTot15 + @SQLTot16 + @SQLTot17 + @SQLTot18 + @SQLTot19 + @SQLTot20 +
|
|
@SQLTot21 + @SQLTot22 + @SQLTot23 + @SQLTot24 + @SQLTot25 + @SQLTot26 + @SQLTot27 + @SQLTot28 + @SQLTot29 + @SQLTot30 +
|
|
@SQLTot31 + @SQLTot32 + @SQLTot33 + @SQLTot34 + @SQLTot35 + @SQLTot36 + @SQLTot37 + @SQLTot38 + @SQLTot39 + @SQLTot40 +
|
|
@SQLTot41 + @SQLTot42 + @SQLTot43 + @SQLTot44 + @SQLTot45 + @SQLTot46 + @SQLTot47 + @SQLTot48 + @SQLTot49 + @SQLTot50 +
|
|
' [' + @RowTotals + ']' + @NewLine +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
)
|
|
end
|
|
end
|
|
else
|
|
begin
|
|
if @TempTableName is not null
|
|
begin -- No row totals, no col totals, temp table
|
|
if @Debug = 1
|
|
begin
|
|
print '--7 No row totals, no col totals, temp table'
|
|
print 'insert into ' + @TempTableName + '(' + @StrippedRowFieldNames
|
|
print @SQLIns1 print @SQLIns2 print @SQLIns3 print @SQLIns4 print @SQLIns5 print @SQLIns6 print @SQLIns7
|
|
print @SQLIns8 print @SQLIns9 print @SQLIns10 print @SQLIns11 print @SQLIns12 print @SQLIns13 print @SQLIns14
|
|
print @SQLIns15 print @SQLIns16 print @SQLIns17 print @SQLIns18 print @SQLIns19 print @SQLIns20 print @SQLIns21
|
|
print @SQLIns22 print @SQLIns23 print @SQLIns24 print @SQLIns25 print @SQLIns26 print @SQLIns27 print @SQLIns28
|
|
print @SQLIns29 print @SQLIns30 print ')' print 'select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print @NewLine + ' from (select ' + @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
end
|
|
|
|
exec ('insert into ' + @TempTableName + '(' + @StrippedRowFieldNames +
|
|
@SQLIns1 + @SQLIns2 + @SQLIns3 + @SQLIns4 + @SQLIns5 + @SQLIns6 + @SQLIns7 + @SQLIns8 + @SQLIns9 + @SQLIns10 +
|
|
@SQLIns11 + @SQLIns12 + @SQLIns13 + @SQLIns14 + @SQLIns15 + @SQLIns16 + @SQLIns17 + @SQLIns18 + @SQLIns19 + @SQLIns20 +
|
|
@SQLIns21 + @SQLIns22 + @SQLIns23 + @SQLIns24 + @SQLIns25 + @SQLIns26 + @SQLIns27 + @SQLIns28 + @SQLIns29 + @SQLIns30 + ')' +
|
|
'select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
)
|
|
end
|
|
else
|
|
begin -- No row totals, no col totals, no temp table
|
|
if @Debug = 1
|
|
begin
|
|
print '--8 No row totals, no col totals, no temp table'
|
|
print 'select ' + @StrippedRowFieldNames
|
|
print @SQLCol1 print @SQLCol2 print @SQLCol3 print @SQLCol4 print @SQLCol5 print @SQLCol6 print @SQLCol7
|
|
print @SQLCol8 print @SQLCol9 print @SQLCol10 print @SQLCol11 print @SQLCol12 print @SQLCol13 print @SQLCol14
|
|
print @SQLCol15 print @SQLCol16 print @SQLCol17 print @SQLCol18 print @SQLCol19 print @SQLCol20 print @SQLCol21
|
|
print @SQLCol22 print @SQLCol23 print @SQLCol24 print @SQLCol25 print @SQLCol26 print @SQLCol27 print @SQLCol28
|
|
print @SQLCol29 print @SQLCol30 print @SQLCol31 print @SQLCol32 print @SQLCol33 print @SQLCol34 print @SQLCol35
|
|
print @SQLCol36 print @SQLCol37 print @SQLCol38 print @SQLCol39 print @SQLCol40 print @SQLCol41 print @SQLCol42
|
|
print @SQLCol43 print @SQLCol44 print @SQLCol45 print @SQLCol46 print @SQLCol47 print @SQLCol48 print @SQLCol49
|
|
print @SQLCol50 print @NewLine + ' from (select ' + @RowFieldNames
|
|
print @SQLCase1 print @SQLCase2 print @SQLCase3 print @SQLCase4 print @SQLCase5 print @SQLCase6 print @SQLCase7
|
|
print @SQLCase8 print @SQLCase9 print @SQLCase10 print @SQLCase11 print @SQLCase12 print @SQLCase13 print @SQLCase14
|
|
print @SQLCase15 print @SQLCase16 print @SQLCase17 print @SQLCase18 print @SQLCase19 print @SQLCase20 print @SQLCase21
|
|
print @SQLCase22 print @SQLCase23 print @SQLCase24 print @SQLCase25 print @SQLCase26 print @SQLCase27 print @SQLCase28
|
|
print @SQLCase29 print @SQLCase30 print @SQLCase31 print @SQLCase32 print @SQLCase33 print @SQLCase34 print @SQLCase35
|
|
print @SQLCase36 print @SQLCase37 print @SQLCase38 print @SQLCase39 print @SQLCase40 print @SQLCase41 print @SQLCase42
|
|
print @SQLCase43 print @SQLCase44 print @SQLCase45 print @SQLCase46 print @SQLCase47 print @SQLCase48 print @SQLCase49
|
|
print @SQLCase50 + @NewLine
|
|
print 'from ' + @SQLSource + @NewLine
|
|
print 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine
|
|
print 'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine
|
|
print 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
end
|
|
--declare @xsql varchar(16000)
|
|
exec ('select ' + @StrippedRowFieldNames +
|
|
-- set @xsql= ('select ' + @StrippedRowFieldNames +
|
|
@SQLCol1 + @SQLCol2 + @SQLCol3 + @SQLCol4 + @SQLCol5 + @SQLCol6 + @SQLCol7 + @SQLCol8 + @SQLCol9 + @SQLCol10 +
|
|
@SQLCol11 + @SQLCol12 + @SQLCol13 + @SQLCol14 + @SQLCol15 + @SQLCol16 + @SQLCol17 + @SQLCol18 + @SQLCol19 + @SQLCol20 +
|
|
@SQLCol21 + @SQLCol22 + @SQLCol23 + @SQLCol24 + @SQLCol25 + @SQLCol26 + @SQLCol27 + @SQLCol28 + @SQLCol29 + @SQLCol30 +
|
|
@SQLCol31 + @SQLCol32 + @SQLCol33 + @SQLCol34 + @SQLCol35 + @SQLCol36 + @SQLCol37 + @SQLCol38 + @SQLCol39 + @SQLCol40 +
|
|
@SQLCol41 + @SQLCol42 + @SQLCol43 + @SQLCol44 + @SQLCol45 + @SQLCol46 + @SQLCol47 + @SQLCol48 + @SQLCol49 + @SQLCol50 +
|
|
@NewLine + ' from (select ' + @RowFieldNames +
|
|
@SQLCase1 + @SQLCase2 + @SQLCase3 + @SQLCase4 + @SQLCase5 + @SQLCase6 + @SQLCase7 + @SQLCase8 + @SQLCase9 + @SQLCase10 +
|
|
@SQLCase11 + @SQLCase12 + @SQLCase13 + @SQLCase14 + @SQLCase15 + @SQLCase16 + @SQLCase17 + @SQLCase18 + @SQLCase19 + @SQLCase20 +
|
|
@SQLCase21 + @SQLCase22 + @SQLCase23 + @SQLCase24 + @SQLCase25 + @SQLCase26 + @SQLCase27 + @SQLCase28 + @SQLCase29 + @SQLCase30 +
|
|
@SQLCase31 + @SQLCase32 + @SQLCase33 + @SQLCase34 + @SQLCase35 + @SQLCase36 + @SQLCase37 + @SQLCase38 + @SQLCase39 + @SQLCase40 +
|
|
@SQLCase41 + @SQLCase42 + @SQLCase43 + @SQLCase44 + @SQLCase45 + @SQLCase46 + @SQLCase47 + @SQLCase48 + @SQLCase49 + @SQLCase50 +
|
|
@NewLine + 'from ' + @SQLSource + @NewLine + 'where ' + @CalcFieldName + ' is not null' + @NewLine + @AddWhere + @NewLine +
|
|
'group by ' + @RowFieldNames + ', ' + @ColFieldID + ') X' + @NewLine + 'group by ' + @StrippedRowFieldNames + @NewLine + @AddOrder
|
|
)
|
|
-- print '-------a'
|
|
-- print @xsql
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
drop table #Columns
|
|
|
|
|
|
|
|
-- Fin.
|
|
|
|
|
|
|
|
GO
|