2014-01-14 52 views
0

以下代碼存儲在SQL Server 2008上的過程中,並使用MS Access中的ADODB執行;我想在Access中執行它時收到以下錯誤......從Access執行SQL Server存儲過程時發生轉換錯誤ADODB

運行時錯誤-2147217913(80040e07)
[微軟] [ODBC SQL Server驅動程序] [SQL服務器]
轉換失敗將nvarchar值'fldNumericData'轉換爲數據類型int時。

fldNumeric僅保留值0,1,2,3,4,和5,但下面的語句失敗...

SELECT Order#, MachineID, Addr1, 
     Addr2, City, [State], Country, ZIP, Contact, Phone, Fax, email, 
     Product, CAST([fldNumeric] AS INT) AS [fldNumeric], 
     CAST([AutoSub] AS INT) AS [AutoSub], Mode, [FileName] 
INTO #sRst1 
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
       'C:\Documents and Settings\database.mdb'; 
       'admin';'',tempTable) LEFT JOIN FN_qryOne() ON fldMatch =       
       FN_qryOne.fldMatch AND fldCutOff = FN_qryOne.fldCutOff 

回答

0

醜,你必須加入一個功能,但這種嘗試:

SELECT Order#, MachineID, Addr1, 
    Addr2, City, [State], Country, ZIP, Contact, Phone, Fax, email, 
    Product, CAST([fldNumeric] AS INT) AS [fldNumeric], 
    CAST([AutoSub] AS INT) AS [AutoSub], Mode, [FileName] 

INTO #sRst1 
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
      'C:\Documents and Settings\database.mdb'; 
      'admin';'',tempTable) AS FM LEFT JOIN FN_qryOne() AS F ON FM.fldMatch =       
      F.fldMatch AND FM.fldCutOff = F.fldCutOff 
+0

仍然拋出錯誤:/ ...有趣的是,它開始後,我爲銀行家四捨五入添加一個UDF(雖然我還沒有實現該功能)。這很奇怪,刪除功能並重新啓動我的電腦將解決問題。 – codingManiac

+0

我認爲,我的問題的根源必須以我的程序編碼的方式進行。 – codingManiac

相關問題