/****** Objekt:  StoredProcedure [CREATE_GLOBAL_TEMP_TABLES]    Skriptdatum: 10/14/2009 10:14:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [CREATE_GLOBAL_TEMP_TABLES]
AS 
BEGIN

IF OBJECT_ID(N'tempdb..##T_PPMS_KOST_VERD') IS NOT NULL
        DROP TABLE ##T_PPMS_KOST_VERD;

CREATE TABLE ##T_PPMS_KOST_VERD
	(
		"PROJEKT" VARCHAR (18) NOT NULL , 
		"AKT_SOLL_KOSTEN" NUMERIC  DEFAULT  0 , 
		"AKT_IST_KOSTEN" NUMERIC  DEFAULT  0 , 
		"AKT_REST_KOSTEN" NUMERIC  DEFAULT  0 , 
		"AKT_GESAMT_KOSTEN" NUMERIC  DEFAULT  0 , 
		"AKT_OBLIGO_KOSTEN" NUMERIC  DEFAULT  0 , 
		"UEB_PROJEKT" VARCHAR (18) , 
		"LVL" NUMERIC (2, 0) , 
		"JAHR" VARCHAR (4) , 
		"KOAGRP" NUMERIC  , 
		"ERLOES" VARCHAR (1) , 
		"AKT_SOLL_AUFW" NUMERIC  , 
		"AKT_IST_AUFW" NUMERIC  , 
		"AKT_REST_AUFW" NUMERIC  
	)

IF OBJECT_ID(N'tempdb..##T_PPMS_RISIKO_VERD') IS NOT NULL
        DROP TABLE ##T_PPMS_RISIKO_VERD;

CREATE TABLE ##T_PPMS_RISIKO_VERD
	(
		"PROJEKT" VARCHAR (18) NOT NULL , 
		"SB_MGL_SCHADEN" NUMERIC  DEFAULT  0 , 
		"SB_WAHR_SCHADEN" NUMERIC  DEFAULT  0 , 
		"SB_EING_SCHADEN" NUMERIC  DEFAULT  0 , 
		"SB_MGL_CHANCE" NUMERIC  DEFAULT  0 , 
		"SB_WAHR_CHANCE" NUMERIC  DEFAULT  0 , 
		"SB_EING_CHANCE" NUMERIC  DEFAULT  0 , 
		"AKT_MGL_SCHADEN" NUMERIC  DEFAULT  0 , 
		"AKT_WAHR_SCHADEN" NUMERIC  DEFAULT  0 , 
		"AKT_EING_SCHADEN" NUMERIC  DEFAULT  0 , 
		"AKT_MGL_CHANCE" NUMERIC  DEFAULT  0 , 
		"AKT_WAHR_CHANCE" NUMERIC  DEFAULT  0 , 
		"AKT_EING_CHANCE" NUMERIC  DEFAULT  0 , 
		"UEB_PROJEKT" VARCHAR (18) , 
		"LVL" NUMERIC (2, 0) 
	)

IF OBJECT_ID(N'tempdb..##PR_COST_TEMP') IS NOT NULL
        DROP TABLE ##PR_COST_TEMP;

CREATE TABLE ##PR_COST_TEMP
	(
		"PROJEKT" VARCHAR (18) NOT NULL , 
		"SOLL_KOSTEN" NUMERIC  DEFAULT  0 , 
		"IST_KOSTEN" NUMERIC  DEFAULT  0 , 
		"REST_KOSTEN" NUMERIC  DEFAULT  0 , 
		"GESAMT_KOSTEN" NUMERIC  DEFAULT  0 , 
		"SAP_KOSTEN" NUMERIC  DEFAULT  0 , 
		"UEB_PROJEKT" VARCHAR (18) , 
		"LVL" NUMERIC (2, 0) , 
		"JAHR" VARCHAR (4) , 
		"KOAGRP" VARCHAR (8) 
	)

END
