Solved

To convert Oracle Query to SQL SERVER Query

Posted on 2004-03-23
3
1,350 Views
Last Modified: 2012-05-04
Hi There ,
I've got this query which runs in Oracle , but the same query doesnt work in SQL Server

Select deal_no , deal_date
From (Select deal_no , deal_date From deals_hdr Where deal_no > 5000) ;

Is it possible to convert this query to ORACLE

Cheerio
Saju

0
Comment
Question by:sajuks
[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
3 Comments
 
LVL 33

Author Comment

by:sajuks
ID: 10656533
Select deal_no , deal_date
From deals_hdr where  exists (Select deal_no , deal_date From deals_hdr Where deal_no > 5000) ;

will work.
 I want to know why oracle allows the above query while sql server does not.
0
 
LVL 1

Accepted Solution

by:
raje10410 earned 125 total points
ID: 10656603
Hi Saju

Change your query as shown below. It'll surely work in SQL Server.

Select deal_no , deal_date
From (Select deal_no , deal_date From deals_hdr Where deal_no > 5000) AS DH ;

The trick is you refer the subquery by an alias. SQL Server has been designed to accept it only in this format.

Cheers,

Rajesh
0
 
LVL 33

Author Comment

by:sajuks
ID: 10673862
Thanks Rajesh .
It works perfectly, any idea how to get the same thing working in Sybase?
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

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

740 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