Solved

SQL Server 2000 and 2005 Compatibility

Posted on 2009-05-04
4
420 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this article I will describe the Copy Database Wizard 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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now