クエリを実行するメソッドを実行するという奇妙な動作があります。ローカルホストでは機能しますが、品質環境では失敗します。クエリとエラーは次のとおりです。
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 でクエリを実行すると、機能します。
メソッドを実行してクエリを実行した場合にのみ機能しません。
手伝って頂けますか?