Solved

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

Posted on 2008-10-23
2
367 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

729 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