Categories: SQL Server

SSMS 22 still inserting tabs instead of spaces

I’m not trying to start up a debate whether you should use tabs or spaces when indenting code. Personally, I prefer spaces because when I copy the code to another editor the outlining of the code remains the same while with tabs it’s not always the case (looking at you, Word and Outlook). But I don’t want to hit the spacebar 4 times whenever I want to indent something, so I use the setting “insert spaces instead of tabs”:

Best of both worlds 🙂 However, recently I was writing some T-SQL code and I noticed that tabs were being inserted instead of spaces. I had just installed SSMS 22 so I thought I forgot to change the settings. But this wasn’t the case, the setting was configured correctly. Maybe the issue is with Redgate SQL Toolbelt, which is installed as an extension into SSMS 22. But also there the setting was applied correctly:

However, when hitting the tab key spaces were not being inserted.

Then I noticed something small in the bottom right corner of the query window:

When clicking on “TABS”, you get the option to switch between tabs and spaces:

When switching to spaces, all tabs are automatically converted to spaces (or the other way around).

Likewise, you can set the encoding and the line endings. It seems that these “query window settings” overrule any settings from the options menu or from any extension. I wasn’t aware that these settings existed in the query window, and maybe by hitting some key combination I accidentally switched from spaces to tabs. I checked SSMS 21 and these options are there as well.

Conclusion: if you want to insert spaces instead of tabs and SSMS is refusing to play along even if all settings are correct, check the bottom right corner of your query window to see if spaces are selected.


------------------------------------------------
Do you like this blog post? You can thank me by buying me a beer 🙂
Koen Verbeeck

Koen Verbeeck is a Microsoft Business Intelligence consultant at AE, helping clients to get insight in their data. Koen has a comprehensive knowledge of the SQL Server BI stack, with a particular love for Integration Services. He's also a speaker at various conferences.

Recent Posts

Webinar Series – SQL Server Indexing

I'm starting a webinar series about SQL Server indexing with the fine folks of MSSQLTips.com.…

4 days ago

ADF Pipeline Debugging Fails with BadRequest – The Sequel

A while ago I blogged about a use case where a pipeline fails during debugging…

2 weeks ago

How to Parameterize Fabric Linked Services in Azure Data Factory for Azure Devops Deployment

Quite the title, so let me set the stage first. You have an Azure Data…

3 weeks ago

dataMinds Saturday 2026 – Slides

At Saturday the 21st of February I'm presenting an introduction to dimensional modelling at dataMinds…

4 weeks ago

Power BI PBIR Format Admin Setting

The Power BI Enhanced Report Format (PBIR) will soon become the default, and that's a…

4 months ago

Logged in as a member of an Azure AD Group Error while Deploying DACPAC

Quite a long title for a short blog post :)While deploying a DACPAC (from a…

4 months ago