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.
ITSM/.svn/pristine/0a/0a8e69563c430bf8ee49d3a1d91...

55 lines
5.4 KiB

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