MSDN > 論壇首頁 > SQL Server Data Access > Openrowset to Oracle doesnt work after upgrading to SQL Server 2005
發問發問
 

問題Openrowset to Oracle doesnt work after upgrading to SQL Server 2005

  • 2007年6月28日 上午 11:33Araki66 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    Hi,

     

    I just upgraded to SQL server 2005 and some of my Openrowset to Oracle doesnt work. I found out that the issue occur with field with structure Numeric.

    The issue is not solve even when I try to cast the field to varchar. sometimes it succeeded and sometimes I get error 7320 & 7321.

    I'm using Oracle connector from SQL to Oracle.

    I've 64 bit SQL Server.

    Attach the code, the Numeric field is SCORE.

     

    select *

    FROM

    OPENROWSET('ORAOLEDB.ORACLE',aaaa;bbbb;cccc,

    'SELECT AUDIT_OPRID, AUDIT_STAMP, AUDIT_ACTN,EMPLID, ACCOMPLISHMENT, MAJOR_CODE,

    CAST(SCORE AS Varchar(250))

    FROM SYSADM.PS_RTA_ACCOMPLISHM WHERE 1=2')

     

    Anyone can advice on resolution?

     

    Thanks,

    Assaf

所有回覆

  • 2007年6月29日 上午 06:55Anton Klimov - MSFT版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Do I understand you correctly that you used to have SQL Server 2000 and the same query worked?

    It also might be useful if you could provide the full text of the messages you are getting.
  • 2007年6月29日 下午 04:05Jens K. Suessmeyer -MSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     


    Sql Server 2005 is locked down by default.

    Go to Program > Microsoft SQL Server 2005 > Configuration Tools > Surface Area Configuration > Surface Area Configuration  for features > AdHoc Remote Queries > Enable OPENROWSET AND OPENDATASOURCE support.

    Jens K. Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---


  • 2007年6月30日 下午 05:49Araki66 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    Hi Guys,

     

    The openrowset is enabled. It was working in 2000 and not working in 2005

    Its working for other tables without fields with Numeric.

     

    here some errors i get

     

    OLE DB provider "ORAOLEDB.ORACLE" for linked server "(null)" returned message "ORA-00910: specified length too long for its datatype".

    Msg 7321, Level 16, State 2, Line 1

    An error occurred while preparing the query "SELECT AUDIT_OPRID, AUDIT_STAMP, AUDIT_ACTN,EMPLID, ACCOMPLISHMENT, DT_ISSUED, MAJOR_CODE,

    CAST(SCORE AS VARCHAR(8000))

    FROM SYSADM.PS_RTA_ACCOMPLISHM WHERE 1=2" for execution against OLE DB provider "ORAOLEDB.ORACLE" for linked server "(null)".

     

    Msg 7320, Level 16, State 2, Line 2

    Cannot execute the query "SELECT AUDIT_OPRID, AUDIT_STAMP, AUDIT_ACTN,EMPLID, ACCOMPLISHMENT, MAJOR_CODE,

    CAST(SCORE AS numeric(38,2))

    FROM SYSADM.PS_RTA_ACCOMPLISHM WHERE 1=2" against OLE DB provider "ORAOLEDB.ORACLE" for linked server "(null)".

     

    Thanks,

    Assaf

  • 2007年7月3日 下午 09:20Jens K. Suessmeyer -MSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    WHats the range of the data ? Is there any data which has a precision of 38 ?

    Jens K. Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---
  • 2007年7月5日 下午 08:14Araki66 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    Yes,

     

    There are Numeric(38,0)

    There are Numeric (7,2)

     

    What the relation between one data type to the import of other fields in the table?

    Do I need to do cast and to what type?

     

    Assaf