Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 CTE QUERRIES POPULATE A TABLE

Author  Topic 

yguyon
Starting Member

11 Posts

Posted - 2014-12-12 : 13:21:17
I have this query UPLOAD AS and I would like to populate a third table Acct_PaymentechAR with its results. Not sure how to do it.

UPLOAD AS (
SELECT BatchID,DateTransaction,CardType--,Last4
,AuthCode,TransType, RIGHT(CARDHOLDER,4) As 'Last4' ,PaymentechAmount,PaymentechOrderId --,DateUploaded,CARDHOLDER
FROM [AcctDept].[dbo].[Acct_PaymentechARTest]

EXCEPT

SELECT BatchID,DateTransaction,CardType,Last4,AuthCode,TransType,PaymentechAmount,PaymentechOrderID
FROM [AcctDept].[dbo].[Acct_PaymentechAR] )

UPLOAD AS (
SELECT BatchID,DateTransaction,CardType--,Last4
,AuthCode,TransType, RIGHT(CARDHOLDER,4) As 'Last4' ,PaymentechAmount,PaymentechOrderId --,DateUploaded,CARDHOLDER
FROM [AcctDept].[dbo].[Acct_PaymentechARTest]

EXCEPT

SELECT BatchID,DateTransaction,CardType,Last4,AuthCode,TransType,PaymentechAmount,PaymentechOrderID
FROM [AcctDept].[dbo].[Acct_PaymentechAR] )




tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-12-12 : 13:44:58
INSERT INTO ...
SELECT * FROM UPLOAD

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -