Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    Posts
    1

    Unanswered: Linked server to Oracle doesn't fetch correct values

    I am using the open query method to connect a Oracle server.
    Below is my code to connect to oracle,when I execute the same query in oracle it fetches 199 rows whereas in Sqlserver it returns only 66 rows.
    I have tried only one record based on id..sqlserver query returns 0 rows..whereas the oracle returns 4 rows..Can some one tell me what will be the problem

    SET QUOTED_IDENTIFIER OFF
    declare @sql varchar(750)
    select @sql = "SELECT * from openquery(PTTSTATUS," + '"' + "SELECT A.PROJECT_ID,C.STATUS_NAME ,A.CNUMBER
    FROM PTT.PTT_PROJECT A, PTT.PTT_STATUS C WHERE (C.STATUS_NAME IN ('Closed', 'Cancelled')) AND A.PROJECT_STATUS_ID = C.STATUS_ID AND A.CNUMBER is not null ORDER BY A.CNUMBER
    " + '")'
    EXEC (@SQL)

    thanks
    Priya

  2. #2
    Join Date
    Feb 2004
    Posts
    492
    So you're saying that PTTSTATUS is an Oracle server linked to from SQLServer, and when you execute the query "SELECT A.PROJECT_ID... ORDER BY A.CNUMBER" from SQLServer it returns less rows than when you execute the same query on Oracle?

    What happens if you execute the query from SQL directly?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •