Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Cannot get SQL Query to Query Oracle tables from a SQL Stored Procedure

Posted on 2008-10-23
2
365 Views
Last Modified: 2012-05-05
Below query will not run.

DBA has created a linked server to oracle server I am running query against.

First time trying to access Oracle tables from SQL.
 
USE [RMReports]
GO
/****** Object:  StoredProcedure [dbo].[usp_test]    Script Date: 10/23/2008 13:50:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[usp_test]
      
AS
BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;



SELECT  [GETPAIDD.CN.CA]..GPCOMP1.GPCOLL.TEAM, [GETPAIDD.CN.CA]..GPCOMP1.GPCOLL.COLLNAME, [GETPAIDD.CN.CA]..GPCOMP1.GPCUST.CUSTNO, [GETPAIDD.CN.CA]..GPCOMP1.GPCUST.COMPANY, [GETPAIDD.CN.CA]..GPCOMP1.GPCUST.NPEST, [GETPAIDD.CN.CA]..GPCOMP1.GPCRDAGEPERF.AVGDAYSPAYP2,
           [GETPAIDD.CN.CA]..GPCOMP1.GPCUST.NPEST - [GETPAIDD.CN.CA]..GPCOMP1.GPCRDAGEPERF.AVGDAYSPAYP2 AS UPDOWN
FROM    [GETPAIDD.CN.CA]..[GPCUST], [GETPAIDD.CN.CA]..[GPCRDAGEPERF], [GETPAIDD.CN.CA]..[GPCOLL]
WHERE  [GETPAIDD.CN.CA]..GPCOMP1.GPCUST.CUSTNO = [GETPAIDD.CN.CA]..GPCOMP1.GPCRDAGEPERF.CUSTNO AND [GETPAIDD.CN.CA]..GPCOMP1.GPCUST.COLLECTOR = [GETPAIDD.CN.CA]..GPCOMP1.GPCOLL.COLLCODE AND (([GETPAIDD.CN.CA]..GPCOMP1.GPCOLL.TEAM <> 'DEFAULT') AND
            ([GETPAIDD.CN.CA]..GPCOMP1.GPCRDAGEPERF.AVGDAYSPAYP2 <> 0) AND ([GETPAIDD.CN.CA]..GPCOMP1.GPCUST.NPEST = 0) OR
            ([GETPAIDD.CN.CA]..GPCOMP1.GPCOLL.TEAM <> 'DEFAULT') AND ([GETPAIDD.CN.CA]..GPCOMP1.GPCRDAGEPERF.AVGDAYSPAYP2 = 0) AND ([GETPAIDD.CN.CA]..GPCOMP1.GPCUST.NPEST <> 0) OR
            ([GETPAIDD.CN.CA]..GPCOMP1.GPCOLL.TEAM <> 'DEFAULT') AND ([GETPAIDD.CN.CA]..GPCOMP1.GPCRDAGEPERF.AVGDAYSPAYP2 <> 0) AND ([GETPAIDD.CN.CA]..GPCOMP1.GPCUST.NPEST <> 0))
ORDER BY GPCOMP1.GPCUST.NPEST DESC


End


Get this error when executing this stored procedure.

Msg 208, Level 16, State 1, Procedure usp_test, Line 12
Invalid object name 'GETPAIDD.CN.CA..GPCUST'.

(1 row(s) affected)



0
Comment
Question by:thayduck
2 Comments
 
LVL 3

Expert Comment

by:richard_crist
ID: 22789513
It may be because of the double dots in CA..GPCUST
0
 

Accepted Solution

by:
thayduck earned 0 total points
ID: 22792055
You need the double dots.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question