Solved

SQL Server 2000 and 2005 Compatibility

Posted on 2009-05-04
4
423 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now