0
我有一個奇怪的行爲,我執行一個運行查詢的方法。它在本地主機上運行,但在質量環境上失敗。查詢和錯誤是如下:僅在運行時查詢錯誤
WITH t AS
(
SELECT
*,
ROW_NUMBER() OVER(PARTITION BY matricola ORDER BY esercizio DESC, cod_valutazione, valutaz_sintetica, matricola, FigureOrder) AS RowN
FROM
(SELECT DISTINCT
'' AS pdf,
Vm.NomeManager + ' ' + Vm.CognomeManager AS valutatore,
vpd.ESERCIZIO AS esercizio,
vpd.cod_valutazione,
Vm.NomeValutato +' ' + Vm.CognomeValutato AS valutato,
vpd.matricola,
valutaz_sintetica,
vpd.COD_STATO AS stato_scheda,
vpd.VALUTAZIONE_RANKING_SINTETICA,
vvv.COD_FIGURA,
CASE
WHEN COD_FIGURA = 'OWNG' THEN 0
WHEN COD_FIGURA = 'VAL1' THEN 1
WHEN COD_FIGURA = 'OWN' THEN 2
END AS FigureOrder
FROM
View_SchedePerDistribuzione vpd
INNER JOIN RL_VALUTAZIONE_VALUTATI_VALUTATORI vvv ON vpd.COD_VALUTAZIONE = vvv.COD_VALUTAZIONE AND vpd.MATRICOLA = vvv.MATRICOLA_VALUTATO
INNER JOIN ValutatiManager Vm ON vpd.MATRICOLA = Vm.MatricolaVAlutato AND vpd.COD_VALUTAZIONE = Vm.COD_VALUTAZIONE
WHERE
vpd.cod_valutazione='PA_SCI_11-12_test' AND
vpd.cod_stato='PROP' AND
chiusa = 0 AND
valutaz_sintetica <> '' AND
VVV.COD_FIGURA IN ('VAL1', 'OWN', 'OWNG') AND
VVV.Matricola = '06000013'
) AS tab)
SELECT *
FROM t
WHERE RowN = 1
ORDER BY esercizio DESC, cod_valutazione, valutaz_sintetica, matricola, FigureOrder
這是錯誤:
nnString=Provider=SQLOLEDB;Data Sourcexxx;Initial Catalog=xxx;Persist Security Info=True;User ID=xxx;Password='xxx';Connect Timeout=xx System.Data.OleDb.OleDbException (0x80040E14):
Incorrect syntax near the keyword 'with'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at valDipLibrary.utility.getQuery(String qry, OleDbTransaction SqlTrn, String ConnString, Boolean fromPool, Boolean logReq, Int32 startRecord, Int32 maxRecord)
at valDipLibrary.utility.getQuery(String qry, OleDbTransaction SqlTrn, String ConnString, Boolean fromPool, Boolean logReq, Int32 startRecord, Int32 maxRecord)
更多信息:
如果我在我的SSMS運行查詢它的工作原理。 如果我在質量服務器的SSMS上運行該查詢,它將起作用。
僅當我運行執行查詢的方法時它才起作用。
你能幫我嗎?
得象「qulaity服務器」!提出正確的答案tho +1 – Andomar 2012-07-27 08:34:12