Forum Discussion
SSMS "Intellisense" behaviour is driving me demented
This behaviour is doing my head in and I'm hoping that there is a simple way to change it?Just to give you an example, I am starting to write a little query to check the status of FullText Indexes on database objects. This is for illustration purposes only so don't tell me what "better" alternatives there are for doing this, I just want to illustrate the behaviour that's bugging me.So the query I would like to run is:SELECT [SO].[name], [FI].[is_enabled] FROM sys.objects [SO] inner join sys.fulltext_indexes [FI] on [FI].object_id = [SO].object_idThe behaviour that annoys me can be illustrated as follows. In SSMS, type this:SELECT * FROM sys.objects [SO] inner join sys.fulltext_indexes [FI] on [FI].object_id = [SO].object_idThen go back to the *, remove it and start typing [SO] in order to get intellisense to show you column names you can choose from. So you have typed [SO] and your cursor is right behind the closing bracket:SELECT [SO]<cursor here> FROM sys.objects [SO] inner join sys.fulltext_indexes [FI] on [FI].object_id = [SO].object_id
Type the dot The statement changes to:SELECT [SOUNDEX]. FROM sys.objects [SO] inner join sys.fulltext_indexes [FI] on [FI].object_id = [SO].object_idI didn't want "soundex". I wanted intellisense to show me a list of column names in sys.objects, aliased to "[SO]" by me. It does that once I hit Ctrl+Z which removes the auto-inserted [SOUNDEX] and then when I hit the dot again it shows me the list of columns. So I pick [name] and start adding the next column by typing , [FI].
And here it goes again:SELECT [SO].[name], [FILE_ID]. FROM sys.objects [SO] inner join sys.fulltext_indexes [FI] on [FI].object_id = [SO].object_idI didn't want [FILE_ID]. I wanted [FI]. and a popup showing the the column names in sys.fulltext_indexes I can choose from.Sure, this is one heck of a "first world problem" but as a touch typist this is driving me around the bend. If there's a way to change this behaviour (without losing Intellisense altogether), please tell me how.
3 Replies
- SlavaMuryginCopper Contributor
That started very recently. (v18)
Use one letter aliases like this:SELECT * FROM tbl_References as r WHERE r
However, when I type a dot after the alias, Intellisense replaces alias by a function name like this:
c -> CAST
r -> RADIANS
s -> string_split
e -> ENCRYPTBYASYMKEYSELECT * FROM tbl_References as r WHERE RADIANS.
Suggestions like "use longer aliases" - won't work. It is easier to turn off Intellisense completely.
Working with SSMS since SQL2000. Never seen such a behavior.
Assume this is a new bug, possibly not from SSMS, but from a .NET framework- SivertSolemIron Contributor
I'm unable to replicate this in SSMS 20.x
- Ronan_prCopper Contributor
This behavior you're describing is known as "Auto-Complete" or "Intellisense" in SQL Server Management Studio (SSMS). It's designed to provide suggestions for column names based on the alias you've used.
The reason this behavior is causing issues in your case is because when you start typing an alias, SSMS assumes it's incomplete and tries to auto-complete it with a default column name. In this case, it defaults to "SOUNDEX".
To disable this behavior without losing Intellisense altogether, you can use the following methods:
1. **Disable Auto-Complete on specific columns:**
You can disable Auto-Complete for individual columns by right-clicking on the column in Object Explorer and selecting "Properties". In the "Column Properties" dialog box, uncheck the "Auto-complete" checkbox.
Alternatively, you can also do this in your query editor:
```sql
SELECT [SO].[name] AS [SO_name],
[FI].object_id
FROM sys.objects [SO] inner join sys.fulltext_indexes [FI] on [FI].object_id = [SO].object_id
```In the above code, I've explicitly aliased the columns to avoid auto-completion.
2. **Disable Auto-Complete globally:**
If you want to disable Auto-Complete for all tables and aliases in SSMS, you can use the following script:
```sql
CREATE TABLE #tempTable (name sysname)
GOINSERT INTO #tempTable SELECT 'test' FROM sys.objects
SELECT * FROM #tempTable [SO] inner join sys.fulltext_indexes [FI] on [FI].object_id = [SO].object_id
```However, this will disable Auto-Complete for all tables in the database.
3. **Use `AS` instead of `[ ]`:**
Another way to avoid auto-completion is by using double quotes (`"`) instead of square brackets (`[]`). Double quotes are not automatically expanded like square brackets are.
```sql
SELECT `"SO".name, [FI].object_id
FROM sys.objects "SO" inner join sys.fulltext_indexes FI on FI.object_id = "SO".object_id
```Please note that using double quotes might not work if your object names contain special characters or spaces.
4. **Use an alias for the table:**
You can also use a different alias for the table to avoid auto-completion:
```sql
SELECT [alias_name] AS [SO],
[FI].object_id
FROM sys.objects alias_name inner join sys.fulltext_indexes FI on FI.object_id = alias_name.object_id
```Replace `[alias_name]` with your actual alias.