Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select queries with *=

Author  Topic 

howardc
Starting Member

3 Posts

Posted - 2014-05-21 : 04:57:28
Hi,

I have inherited some old VB6 code and some of the queries in this code are not running on the SQL Server 2012. I do not know if this is because the code was written for older versions of SQL Server or because the syntax is just wrong. I have searched the internet (and this forum) for the syntax but cannot find any references.

The syntax appears to have something to do with joins, and looks like this:

select * from table1, table2 where table1.keyfield *= table2.keyfield;

The "*=" is not understood in the query - and I can find no reference to it being used anywhere.

Anyone have any ideas as to what it means, and what I would need to do to get it working?

Thanks.

Howard

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-05-21 : 05:14:20
*= is LEFT OUTER JOIN
=* is RIGHT OUTER JOIN
change to

select *
from table1
LEFT OUTER JOIN table2
ON table1.keyfield = table2.keyfield
where table1.keyfield *= table2.keyfield;



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

howardc
Starting Member

3 Posts

Posted - 2014-05-21 : 05:23:10
Thanks KH. Is this something that was dropped for later versions of SQL Server? If so can I change the compatibility to enable it to work in 2008 or 2012?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-05-21 : 05:38:59
since SQL Server 2005. You will need to set the compatibility level to 80 (SQL 2000) for your code to work.

My advice is to modify the query, as from SQL 2012 onwards, you can't set it to 80. SQL Server 2008 R2 is the last version that you can do that.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

howardc
Starting Member

3 Posts

Posted - 2014-05-21 : 06:27:02
Thanks KH. I think I will replace it using the standard format as you suggest.
Appreciate your help.
Go to Top of Page
   

- Advertisement -