如何将数据从一个表复制到另一个表

时间:2019-06-26 15:38:44

标签: sql-server tsql sql-insert

我写了一个查询,如下所示,将数据从一个表复制到另一个表。一切似乎都很好,但是当代码运行时,我得到一个错误-','附近的语法不正确。

请帮助。

USE [DWCNEW]

INSERT into DWCNEW..PostAP
SELECT TxDate, Id, AccountLink, TrCodeID, Debit, Credit, iCurrencyID, fExchangeRate, fForeignDebit, fForeignCredit, Description, TaxTypeID, Reference, Order_No, ExtOrderNum, cAuditNumber, Tax_Amount, fForeignTax, Project, Outstanding, fForeignOutstanding, cAllocs, InvNumKey, CRCCheck, DTStamp, UserName, iTaxPeriodID, cReference2, iAge, dDateAged, iPostSettlementTermsID, iTxBranchID, bPBTPaid, iGLTaxAccountID, bTxOnHold, PostAP_iBranchID, PostAP_dCreatedDate, PostAP_dModifiedDate, PostAP_iCreatedBranchID, PostAP_iModifiedBranchID, PostAP_iCreatedAgentID, PostAP_iModifiedAgentID, PostAP_iChangeSetID
FROM DWCLive22..PostAP

1 个答案:

答案 0 :(得分:1)

将INERT插入newTable(col1,col2,col3) SELECT列1,列2,列3 来自oldTable

相关问题