SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Fully Qualified Object Names not working for selected joins
Goto page Previous  1, 2
 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Fully Qualified Object Names not working for selected joins
Author Message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
This is fixed in 5.1.10. Please give it a try.
Tue Aug 24, 2010 1:11 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
It seems to work.
Mon Sep 06, 2010 9:09 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Thank you for the status update
Thu Sep 09, 2010 6:41 am View user's profile Send private message
judahr



Joined: 09 Mar 2007
Posts: 319
Country: United States

Post Not Quite Reply with quote
in 5.1.7 and 5.1.10 PRO

Assuming:

Select *
From dbo.Table t
Inner join

From here, if you select just the table, now it outputs the schema duplicated:
dbo.dbo.Table1

it should output:
dbo.Table1

if you select the columns, it operates correctly.
Thu Sep 09, 2010 3:45 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2109

Post Reply with quote
That's strange. I tried it your way but it still worked. No matter if I select the table from the section that offers join conditions or otherwise.
Fri Sep 10, 2010 2:10 am View user's profile Send private message
judahr



Joined: 09 Mar 2007
Posts: 319
Country: United States

Post Reply with quote
On a whim, I reloaded the default DB Queries, and now it works fine.
Fri Sep 10, 2010 9:05 am View user's profile Send private message
Olegon



Joined: 07 Sep 2009
Posts: 39
Country: Kazakhstan

Post Reply with quote
SysOp wrote:
This is fixed in 5.1.10. Please give it a try.


It's work. Thanks!

But:


Code:

use Northwind
go

select
  *
from
  dbo.Categories c
  inner join


selected foreign key:

Code:
select
  *
from
  dbo.Categories c
  inner join Northwind.dbo.Products p
    on
      p.CategoryID = c.CategoryID


should be:

Code:
select
  *
from
  dbo.Categories c
  inner join dbo.Products p
    on
      p.CategoryID = c.CategoryID


Because Northwind alredy current database.
Not so important, but specifically when you write SQL that will be used on databases with different names but having same structure.
Tue Oct 05, 2010 5:41 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Hi,

We are aware of this issue. We've an open case #SA-11505 describing random full qualification of object names in JOIN suggestions. Our development team is unable so far to reproduce this issue. If it happens to you consistently or you noticed a specific pattern for reproducing this issue, please describe the required steps.

Thank you
Tue Oct 05, 2010 8:54 am View user's profile Send private message
Olegon



Joined: 07 Sep 2009
Posts: 39
Country: Kazakhstan

Post Reply with quote
I use:
MS SQL Server 2000, 2005, 2008
MS SQL Server Managment Studio 2008
SQL Assistant 5.1.10

Simple in MSSMS I opened new query, I selected Northwind database and wrote this query:

Code:
select
from
  dbo.CntActions ca
  inner join


In SQL Assitant I selected foreign key:




In result I got this:



When it's should be like this:



Without specifying the database Northwind in join.
Thu Oct 07, 2010 7:01 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Please try reloading the default DB Queries in the settings. This might be a result of upgrades from previous SQL Assistant versions and maintenance releases. While db queries from the older versions can still be used, they may produce side effects like the one described here with full table name qualification. The newest versions have updated definitions for DB queries retrieving data for joins.
Thu Oct 07, 2010 9:07 am View user's profile Send private message
Olegon



Joined: 07 Sep 2009
Posts: 39
Country: Kazakhstan

Post Reply with quote
SysOp wrote:
Please try reloading the default DB Queries in the settings.


Yes, now it's working. Thank you!
Fri Oct 08, 2010 12:56 am View user's profile Send private message
Olegon



Joined: 07 Sep 2009
Posts: 39
Country: Kazakhstan

Post Reply with quote
Something wrong with this function :)
I loaded default settings.

I set "With database and schema names" in DB options.

Code:
use master
go


Code:
select
  *
from
  Northwind.dbo.Categories c
  inner join


After I selected FK to dbo.Products.
Result is:

Code:
select
  *
from
  Northwind.dbo.Categories c
  inner join Northwind.dbo.Products p on p.CategoryID = c.CategoryID


It's OK. SQL Assistant added "Northwind" and "dbo" before table name.

Set current database to Northwind.

Code:
use Northwind
go


Code:
select
  *
from
  dbo.Categories c
  inner join


After I selected FK to dbo.Products.
Result is:

Code:
select
  *
from
  dbo.Categories c
  inner join Northwind.dbo.Products p on p.CategoryID = c.CategoryID


SQL Assistant again added "Northwind" and "dbo" before table name. But not need to do it, because Northwind is current database.

When I tried with option "Only for objects in other schema or database" in DB options.
Result is:

Code:
use Northwind
go


Code:
select
  *
from
  dbo.Categories c
  inner join Products p on p.CategoryID = c.CategoryID


Almost OK, but without shema name "dbo".

Code:
use master
go


Code:
select
  *
from
  Northwind.dbo.Categories c
  inner join


Result is:

Code:
select
  *
from
  Northwind.dbo.Categories c
  inner join Products p on p.CategoryID = c.CategoryID


Same result as above.

I think with option "Only for objects in other schema or database" it's should be:

Code:
use master
go


Code:
select
  *
from
  Northwind.dbo.Categories c
  inner join Northwind.dbo.Products p on p.CategoryID = c.CategoryID


With database name and schema name.

Code:
use Northwind
go


Code:
select
  *
from
  dbo.Categories c
  inner join dbo.Products p on p.CategoryID = c.CategoryID


Only with schema name.
Mon Oct 18, 2010 12:39 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
"With database and schema names" is for "Always fully qualify..." option. By definition this option does not care what the current database is. It should always add db and schema names. It is a bit different for "With schema name". If the table is not in the current database, it should be fully qualified in db.schema.table format. Similarly when you choose "Only for objects in other schema or database" and then pick a table in dbo schema, it doesn't need to be qualified with the schema name because it is in the current schema.

However, I totally agree with you that there is a problem in the last case

Code:

use master
go

SELECT *
FROM Northwind.dbo.Categories c
  inner JOIN Products p ON p.CategoryID = c.CategoryID


This is incorrect. The Product table reference is missing db and schema name qualification. I'm going to log a bug report for this issue.
Mon Oct 18, 2010 1:32 am View user's profile Send private message
Olegon



Joined: 07 Sep 2009
Posts: 39
Country: Kazakhstan

Post Reply with quote
Your are right, I agree with you.

So with option "With schema name" will be work as:
- if table in the current database then dbo.table;
- if table not in the current database then db.dbo.table.

With option "Only for objects in other schema or database" will be work as:
- if table in the current database then only table name;
- if table not in the current database then db.dbo.table.

Do I understand correctly?
Mon Oct 18, 2010 1:55 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.