Groups | Blog | Home
all groups > sql server connect > november 2004 >

sql server connect : Linked server to oracle doesn't fetch correct datavalues



GP
11/1/2004 10:40:04 AM
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
GP
11/1/2004 2:55:01 PM
Sorry I am connecting to two different databases.That's why the results are
different.

[quoted text, click to view]
AddThis Social Bookmark Button