GPSPOW
asked on
Union 4 Sql views into one temporary table
I have the attached code to union 4 SQL views into a temporary table but I can't get the correct syntax. Please help.
/****Combine PM Balance and CM transactions into one table********/
SELECT [PeriodDateTime]
,[PMBal]
,[PEStatus]
,[AccountNumber]
,[TxnAmount]
,[CAmt]
,[BDAmt]
,[CurStatus]
into #Rollup
FROM [livedb].[dbo].[vw_DAILY_ROLLUP_PEBAL]
union
SELECT DATEADD(mm,datediff(mm,0,getdate()),0) as PeriodDateTime
,[PEBal]
,[PEStatus]
,[AccountNumber]
,[TxnAmount]
,[CAmt]
,[BDAmt]
,[CurStatus]
FROM [livedb].[dbo].[vw_DAILY_ROLLUP_CHARGES]
union
SELECT DATEADD(mm,datediff(mm,0,getdate()),0) as PeriodDateTime
,[PEBal]
,[PEStatus]
,[AccountNumber]
,[TxnAmount]
,[CAmt]
,[BDAmt]
,[CurStatus]
FROM [livedb].[dbo].[vw_DAILY_ROLLUP_COLLTXNS]
union
SELECT DATEADD(mm,datediff(mm,0,getdate()),0) as PeriodDateTime
,[PEBal]
,[PEStatus]
,[AccountNumber]
,[TxnAmount]
,[CAmt]
,[BDAmt]
,[CurStatus]
FROM [livedb].[dbo].[vw_DAILY_ROLLUPS_BDXFER]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.