I have around 200-250 reports that have been developed in SQL Server 2000 and I have used *= , =* in many places. So recently we migrated to SQL Server 2008 and all reports have to be fixed for the 2008 standard.
So I have couple of issue in compatibility like
"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."
So it takes long time to re-query all things and fixing. Even we don't need to enable backward compatibility of 2008, we do need to fix all those queries...
Is there any tool that will fix all those queries easily?
Thanks and Best Regards,
The Microsoft SQL Server 2008 Upgrade Advisor should identify the offending TSQL, but it won't fix it for you.
It is a prudent idea to run the SQL Server 2008 Upgrade Advisor on all Databases to be upgraded.
There is no tool. How can any tool know what the semantics would be of this, for example?
You are changing
FROM Table1 T1, Table2 T2, Table2 T3
WHERE T1.key *= T2.key AND T1.key = T3.key AND T3.foo = 'bar'
to
FROM
Table T1
JOIN
Table T3 ON T1.key = T3.key
LEFT JOIN
Table T2 ON T1.key = T3.key
WHERE
T3.foo = 'bar'
You have been able to use JOIN/LEFT JOIN etc since at least SQL Server 6.5: using *= for SQL Server 2000 was ignorance and/or laziness
There is a tool built into SSMS that can help, but you will still need to test. See my post on SSC which describes the technique:
http://www.sqlservercentral.com/Forums/FindPost1098339.aspx
Related
I have a Temp view:
sales.createOrReplaceTempView("sales")
I want to use this tempView in a SQL server query:
select distinct
t2.id,
t1.prod
from prod t1
join sales t2 on t2.id = t1.id
The prod table (t1) is stored in sql server and sales table (t2) is a tempView.
How should I run this query? Is it possible to run this using JDBC?
Your Spark Application is running on a different cluster of machines out of which you are creating a temporary view. Your sql-server is running on a different machine and you created a table on it. These both components are speaking different languages of data. You can always connect them and bring either of these to the opposite platform and then work with the 2 tables/views on the common platform but you cannot simply join the tables on different platforms.
Anyone know what is the ORM function for joining multiple db tables in ERPNext?
I need query result from 2 DB tables join using script report
*I don't need query report answer since i already have it. I only looking for an example do it using script report
Frappe currently doesn't have ORM support for joining tables. You might have to use frappe.db.sql for the time being.
data = frappe.db.sql(
"""
select tb1.name from tabTable1 as tb1
left join tabTable2 as tb2 on tb1.name = tb2.employee_name;
"""
);
return data
I have an SQL script I want to replicate inside tableau using tableau's joins.
SQL script (script simplified just for explanation):
Select *
From transactions
Inner join data1
UNION
Select *
From transactions
Inner join data2
How do replicate this in tableau using joins n unions? (No tableau custom SQL please)
You can do manual unions or wildcard unions: Tableau Help
Depending on your data connection, some features of it may or may not be supported.
Same with joins, lots of ways to do it: Tableau Help
Make sure you're looking up the docs and searching for an answer before posting. These types of this are easy to find.
As the title suggests, does an equal to the lateral join exist in redshift? I haven't run into a situation where it might be necessary yet, but it seems hard to imagine replicating the functionality of a lateral join if I needed to with what I know now.
TSQL -- how does optimizer deal with joins with unused tables
SELECT table1.col1, table2.col1, table2.col2 -- etc.
FROM dbo.table1
LEFT JOIN dbo.table2
on (table1.id = table2.id)
LEFT JOIN dbo.table3
on (table1.id = table3.id)
In the simple example above it is obvious that table 3 isn't needed, however more intricate cases can exist.
Question: Is the TSQL query optimizer able to determine that the JOIN with table 3 isn't needed? If so, would it potentially miss other optimizations for more complex queries, if table3 wasn't manually removed from the query?
I use SSMS 14.017 with an underlying SQL database of select ##version = Microsoft SQL Server 2014 (SP3)
Yes, query optimizer could skip table3 because it is not referenced in SELECT list and the join condition is LEFT OUTER JOIN so there is no filtering.
Related: 10 Cool SQL Optimisations That do not Depend on the Cost Model by Lukas Eder:
Unneeded Table Accesses
JOIN Elimination
JOIN Elimination: An Essential Optimiser Feature for Advanced SQL Usage