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.

71 lines
4.3 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

USE [Vertragsverwaltung_20160404]
GO
/****** Object: StoredProcedure [dbo].[sp_get_stammdaten] Script Date: 02.12.2016 09:08:53 ******/
DROP PROCEDURE [dbo].[sp_get_stammdaten]
GO
/****** Object: StoredProcedure [dbo].[sp_get_stammdaten] Script Date: 02.12.2016 09:08:55 ******/
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