这是一个严重的问题:它是否在Sql Query Analyzer?
我面临奇怪的情况,我在Sql Query Analyzer的问询中做了测试:
insert into PLCommonTotal(CmnTotal)
select
case
when p.NetpurTot > s.NetsalTot then
(
select NetpurTot from PLPurchaseTotal
)
else
(
Select NetsalTot from PLSaleTotal
)
end
from PLPurchaseTotal p
join PLSaleTotal s
on p.companyID=s.companyID
select * from PLCommonTotal
该公司从Sql Query Analyzer处工作,没有错误。
如今,在2005年5月5日调查了同样的问题:
string tot5 = " insert into PLCommonTotal(CmnTotal)" +
" select" +
" case" +
" when p.NetpurTot > s.NetsalTot then" +
" (" +
" select NetpurTot from PLPurchaseTotal" +
" )" +
" else" +
" (" +
" Select NetsalTot from PLSaleTotal" +
" )" +
" end" +
" from PLPurchaseTotal p" +
" join PLSaleTotal s" +
" on p.companyID=s.companyID";
SqlCommand comcmd = new SqlCommand(tot5, con);
comcmd.Transaction = trans;
comcmd.ExecuteNonQuery();
This is throw Sql Error : “ subquery return more than one value. This is not permitted when the subquery follows = != < <= > >= or when the subquery used an expression. The statement has been termited”.
I want to ask the question if it is not permitted than why it is executed from SQL Query analyzer without any error?.
Is there fault of SQL Team?.