SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Table alias "lei" not working

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Table alias "lei" not working
Author Message
judahr



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

Post Table alias "lei" not working Reply with quote
v2.5.14 - Query Analyzer

This works:
Select * From dbo.Date d where d.

This doesn't:
Select * From dbo.Date lei where lei.

lei is not setup as a snippet in T-SQL. Are there other aliases that won't work?
Wed Aug 15, 2007 3:33 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6508

Post Reply with quote
I am unable to reproduce this. Please try again, make sure you type a space after WHERE then type "leu." including the dot.
Wed Aug 15, 2007 3:40 pm View user's profile Send private message
judahr



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

Post Reply with quote
lei consistently regardless of database or table. Only Query Analyzer, not Mgmt Studio. Only when connected to one server. Closing and reopening QA still produces the same issue.
Wed Aug 15, 2007 4:15 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6508

Post Reply with quote
It sounds like you are connecting to wrong server and there is no such table or view or table function Date in the current database.

Does it work for table sysobjects? (SELECT * FROM sysobjects lei WHERE lei.)

When you type WHERE then press space, do you get a popup with the column names? If yes, what is displayed in the top most line? Does it say "lei -- alias for dbo.Date"?


Last edited by SysOp on Thu Aug 16, 2007 9:00 am; edited 1 time in total
Wed Aug 15, 2007 4:35 pm View user's profile Send private message
judahr



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

Post Reply with quote
I get the issue no matter what table name I select. When I press space after where, no column names appear. If I change the alias it works fine.
Thu Aug 16, 2007 8:16 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6508

Post Reply with quote
Are you sure there is no "lei" object or schema in the database?
Have you tried sysobjects?
Code:
SELECT * FROM sysobjects lei WHERE lei.

Thu Aug 16, 2007 9:00 am View user's profile Send private message
judahr



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

Post Reply with quote
Found the possible connection: There is a user named lei, but no schema and no access to any databases. In fact if you alias a table by any standard SQL login user, you will see the issue.
Thu Aug 16, 2007 9:56 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6508

Post Reply with quote
I'm glad you found the cause. The lei user is still reported as a schema owner, it is a database user, not a login. When you type "lei." the database names are searched first, then schema names, then object names, then aliases. So the "lei" is found in schema. Because there are no objects in the schema, the prompt list is empty and the popup is not shown. This makes sense to me. In order to avoid getting into this situation again, please use aliases that don't match schema or database names.
Thu Aug 16, 2007 10:24 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
Page 1 of 1

 
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.