Solved

t-sql refactoring

Posted on 2014-01-08
2
342 Views
Last Modified: 2014-01-09
Hi experts,

I have a sql server stored procedure that was created in 2000.

I'm currently using Sql Server 2008 R2.

The database this stored procedure is located in is currently set to a compatibility_level = 100

When I run the stored procedure I get the error shown below.

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, using the SET COMPATIBILITY_LEVEL option of ALTER DATABASE. 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.

When I change the compatibility level of my database to compatibility_level = 80 then my query runs fine.

I don't want to change the compatibility level.  I want my compatibiliy_level to remain at 100.
So according to the error message I get, I figure my only option is to rewrite the query.

It's kind of a complex query.
Is there a tool out there? Whether its a free or commercial tool,  
where I can just paste my existing query in and it will refactor my query to a more current syntax that will be able to run on my database when I set it to compatibility_level = 100

thanks.
0
Comment
Question by:maqskywalker
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 39766474
I am not aware of a tool, you will need to manually rewrite the query.
but I would like to see if such a tool would exist...

... if it where simple, ms would already have it build into it's GUI tools, and hint to that tool when this error is raised ...
0
 
LVL 69

Expert Comment

by:ScottPletcher
ID: 39766540
Just the outer joins shouldn't be that hard to rewrite.

Post the FROM and the WHERE conditions of the query; don't really need the SELECT list.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
separate column 24 20
Scheduling Jobs for Execution: 4 15
Troubleshooting Methodology - steps 3 22
Minus first query 1 0
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.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

760 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