Comments
12 comments
-
Hi Adam,
In the first case SELECT * FROM Hum works fine for me, however if SQL Prompt was still loading the meta-data, or finished after the popup appeared, or failed to load the meta-data for some reason it's likely that HumanResources would not appear until you typed the following 'a' or moved the caret to a different position and back again.
In the second case you should switch on the "Qualify object names" option in the Options dialog, which is switched off by default. You can access this by clicking the SQL Prompt > Options item on the main menu of either Management Studio or Query Analyzer and you'll find it on the "Style" tab. Clearly not qualifying object names under SQL Server 2005 often generates SQL that will not execute, however we felt it would be confusing if object names were qualified when this option was not checked even where this would be required for the SQL to be correct.
Hope that sorts you out.
Thanks,
Bart -
OK, I just tried again, and it's quite a bit better. Not sure what happened last time, as SSMS had been open for a while before I tried, but anyway...
What happens now:
SELECT *
FROM hum
-- get HumanResources
Hit [Enter]. Then type "."
-- get no tables
Hit [Backspace]. Then type "." again
-- Now I get a list of tables...
So if you can just fix that extra [Backspace]/"." requirement, things will be very nice -
Hi Adam,
Got to be honest and say I've NO idea why you're seeing that behaviour as it works fine for me in both Management Studio and Query Analyzer. I don't think anybody else has reported it either, otherwise it would certainly have turned up in my bug list. You say you get no tables initially, so what do you get instead, if anything? It's just bizarre.
Dealing with the simplest possible case first, can you make sure that "Show objects for specified owner or schema" is switched on (you'll find it on the Candidates tab of the Options dialog). This should be switched on by default in any case, but it's probably best to check.
Thanks,
Bart -
OK, I just checked, and yes, that's checked.
If I just hit "." after hitting [Enter] (when I select HumanResources from the candidates list), nothing happens. I don't get a list of tables until I do [Backspace], then type "." again...
By the way, some other weird behavior I just found:
Type:
SELECT * FROM hum.
(period after hum) -- A list of tables in the current database pops up, in alphabetical order. I personally don't think a candidate list makes sense there. Better would be that as soon as I hit ".", HumanResources is automatically selected and I'd see a list of tables in the schema -- that would be in-line with the way intellisense in VS works. -
What happens if you force the candidate list with CTRL+SPACE after the '.'?
-
That works -- pops up a correct list.
-
OK thanks, that's good to know. I need to take another look at the popup behaviour anyway before the final release as it's still a little bit on the aggressive side, although to be honest I think less aggressive than both Visual Studio 2005 and ReSharper.
Cheers,
Bart -
Aggressive isn't necessarily a bad thing. My biggest complaint right now is that I can't do the:
SELECT * FROM hum.
... and have it automatically select HumanResources and then immediately present a list of choices from there. That's how VS2005 works (at least, the C# intellisense, which in my opinion is by far the best I've ever worked with -- the VB intellisense in 2005 is crap IMO)... I still feel like the SQLPrompt intellisense is working against me just a bit instead of with me all the time. The VS intellisense pops up all the time, but I rarely feel like it's in my way (it does happen, but only maybe 1% of the time). With SQLPrompt, that number is currently around 25%, and then of course it's not even popping up sometimes when it should. So maybe you need it to be more aggressive, but at the same time a little bit smarter. -
Hi Adam,
I think the when it should/shouldn't popup issue is probably the most contentious thing we have to address. I think you're right though, after a '.' is a very sensible time for it to pop up and I'll be spending some time tuning this after Christmas. SQL's such a pain in the backside for this though because you can use virtually any character (even tabs and returns) as part of an identifier as long as you enclose it in square braces, which means that context becomes far more important than it is for C#, where all you basically have to worry about is whether or not you're inside a string literal.
(BTW: if anybody complains that SQL Prompt 3 doesn't work with identifiers that contain line breaks I will not be held responsible for my actions - we have a tester who just delights in coming up with corner cases like this just to wind up all the developers.)
Cheers,
Bart -
To be honest, I wish you hadn't told me about the line breaks in identifiers... it's one of those things I'm going to pretend I never heard (*puts hands over eyes and ears*)
-
There are even more fun cases such as tables called [ ] or even
[
]
I'm not sure you deserve intellisense if your table/column looks like this: [ ].[
]
:-) -
Haha, yeah, I'll drink to that.
Add comment
Please sign in to leave a comment.
GO
SELECT *
FROM Hum
... Where is HumanResources?
And even worse:
USE AdventureWorks
GO
SELECT *
FROM Emp
... Employee does come up (it's in the HumanResources schema) -- but when I hit Enter, the table is not schema-qualified. This is a major issue -- I've been making heavy use of schemas and lack of support makes this product pretty much unusable for me.