?
Solved

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

Posted on 2008-10-23
2
Medium Priority
?
369 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

771 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