Solved

SQL Server 2000 and 2005 Compatibility

Posted on 2009-05-04
4
427 Views
Last Modified: 2012-05-06
Hi,
I have a SQL server 2000 database running on SQL 2005 engine with compatibility mode set to 2000.Now when i generate my database script and run it on the 2005 database i get following error :

The query uses non-ANSI outer join operators ("*=" or "=*"). To run this query without modification, please set the compatibility level for current database to 80 or lower, using stored procedure sp_dbcmptlevel. It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN). In the future versions of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes.

I tried to check on the issue and one of the Store proc had following

select @OverRiddenValue = OverriddenAmount from
                        TaxPosition tp, PreAdoptionData Pd
                        where tp.id *= pd.PositionId
                        and pd.PeriodYear = @PreAdoptionYear
                        and pd.PeriodQtr = @PreAdoptionQtr
                        and tp.id = @PositionId

Can any one tell me how to fix this.
Thanks
0
Comment
Question by:aspnetdev
  • 3
4 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 500 total points
ID: 24295940
You can change the above query to use a LEFT OUTER JOIN.  Just to clarify:

*= is a LEFT OUTER JOIN
=* is a RIGHT OUTER JOIN

You code should look like the code below.

Greg



SELECT @OverRiddenValue = OverriddenAmount 
FROM TaxPosition tp LEFT OUTER JOIN  
	   PreAdoptionData Pd ON tp.identity_columns AS ic = pd.PositionId
WHERE pd.PeriodYear = @PreAdoptionYear AND pd.PeriodQtr = @PreAdoptionQtr AND tp.id = @PositionId

Open in new window

0
 
LVL 21

Expert Comment

by:JestersGrind
ID: 24295961
By the way if you are getting that error message, the database is not running in SQL 2000 compatibility mode(compatibility level 80)

Greg


0
 

Author Comment

by:aspnetdev
ID: 24296364
Thanks for the reply Greg but my question is why are you using this :
tp.identity_columns AS ic could i not write simply as

SELECT @OverRiddenValue = OverriddenAmount FROM
           TaxPosition tp LEFT OUTER JOIN  
           PreAdoptionData Pd ON tp.id = pd.PositionId
WHERE pd.PeriodYear = @PreAdoptionYear AND pd.PeriodQtr = @PreAdoptionQtr AND tp.id = @PositionId

Does it make sense?
Thanks
0
 
LVL 21

Expert Comment

by:JestersGrind
ID: 24296424
Sorry about that.  I'm using SQL Prompt, which is an SQL intellisense-type tool.  Sometimes if I'm not careful, it resolves things incorrectly (especially when the query I'm writing is against a table that doesn't exist on my end) and puts wrong information in the query.  

Anyway, the query that you have above is correct.  Sorry for the confusion.

Greg


0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQl server restarts itself 6 37
Stored procedure 4 32
how many extra RAM for SQL server is needed 22 39
Sql query 107 61
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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