我在','附近出现此语法错误
我已经尝试了一些解决方案,因为此论坛之前已经问过这个问题,但无济于事。
class="sidebar --opened"
他们的查询有问题吗?因为我已经检查了2天,没有发现任何错误,这不是我所知道的。 希望任何人都能帮忙。
答案 0 :(得分:1)
您是否尝试取消对DocType的引用?
string sqlSelect = "SELECT"
+ " 'RI' AS DocType, DebtorCode, DocNo, DocDate, [Description]"
+ ",SalesAgent, LocalNetTotal AS LocalAmount,"
+ "(Outstanding * CurrencyRate) AS LocalBalance"
+ " FROM ARINVOICE"
+ " WHERE Cancelled = 'F'"
+ " UNION"
+ " SELECT 'RD' AS DocType, DebtorCode, DocNo, DocDate, [Description]"
+ ",SalesAgent, LocalNetTotal AS LocalAmount"
+ ",Outstanding AS LocalBalance"
+ " FROM ARDN"
+ " WHERE Cancelled = 'F'"
+ " UNION"
+ " SELECT 'RC' AS DocType, DebtorCode, DocNo, DocDate, [Description]"
+ ",'' AS SalesAgent, LocalNetTotal AS LocalAmount"
+ ",(NetTotal - KnockOffAmt + RefundAmt) * CurrencyRate AS LocalBalance"
+ " FROM ARCN"
+ " WHERE Cancelled = 'F'"
+ " UNION"
+ " SELECT 'RP' AS DocType, DebtorCode, DocNo, DocDate,
[Description]"
+ ",'' AS SalesAgent, LocalPaymentAmt AS LocalAmount"
+ ",LocalUnappliedAmount AS LocalBalance"
+ " FROM ARPAYMENT"
+ " WHERE Cancelled = 'F'";
答案 1 :(得分:0)
在SQL SERVER中,检查以下脚本-
declare @sqlSelect nvarchar(max)
select @sqlSelect = N'
SELECT ''RI'' AS DocType,DebtorCode,DocNo,DocDate,[Description],SalesAgent,LocalNetTotal AS LocalAmount,
(Outstanding * CurrencyRate) AS LocalBalance
FROM ARINVOICE WHERE Cancelled = ''F''
UNION
SELECT ''RD'' AS DocType,DebtorCode,DocNo,DocDate,[Description],SalesAgent,LocalNetTotal AS LocalAmount,Outstanding AS LocalBalance
FROM ARDN WHERE Cancelled = ''F''
UNION
SELECT ''RC'' AS DocType,DebtorCode,DocNo,DocDate,[Description],'''' AS SalesAgent,LocalNetTotal AS LocalAmount,
((NetTotal - KnockOffAmt + RefundAmt) * CurrencyRate) AS LocalBalance
FROM ARCN WHERE Cancelled = ''F''
UNION
SELECT ''RP'' AS DocType,DebtorCode,DocNo,DocDate,[Description],'''' AS SalesAgent,LocalPaymentAmt AS LocalAmount,
LocalUnappliedAmount AS LocalBalance
FROM ARPAYMENT WHERE Cancelled = ''F'' '
print (@sqlSelect)
--exec (@sqlSelect)