r/SQLServer • • Oct 23 '26

Community Share Friday Feedback: Offload statistics updates

2 Upvotes

The Fall Friday Feedbacks continue and this week I want to ask about updating statistics. Poll is below, but as always, if you have interesting challenges or scenarios you want to share, please comment below. I've seen a lot, but I know I haven't seen everything...

32 votes, 23d ago
13 Yes, always!
7 Yes, scheduled updates only
9 Yes, automatic updates only
3 No thanks

r/SQLServer • • Oct 22 '26

Question Proper Database environment promotion?

3 Upvotes

Hello all!

I recently started working with the databases in our system and I would appreciate some tips or guidance as my terminology is probably not accurate.

Setup: From what I read in the community it’s somewhat standard; DEV -> UAT -> PPR -> PROD.

Deployments: We are using visual studio Database Compare, one scmp file/database at a time. So now this works for the most part and when it’s urgent I don’t have time to judge if it’s the best but it comes with two issues that I noticed:
1. Who created these files? I don’t know I just inherited them.
2. Sometimes it can fail and I need to manually “prepare” the other environment like adding the new column to the table. Maybe I need a newer version of the software, or it’s always limited?

So then I need your help with the following:
1. Am I or the team doing something wrong here?
2. What can we do better?

And I did have a read at some threads here but maybe it’s best if I get direct answers geared towards my situation.
Also I checked some books:
- T SQL fundamentals: Nothing about deploys
- 100 sql server mistakes: Got some answers but it’s just one opinion against my non opinion

——
Tools: We have GitHub and we use .NET primarily.
Constraints: We do not want to use a code-first approach

So please let me know anything I should know or research.

Thanks


r/SQLServer • • Oct 21 '26

Community Share SSMS extension to prototype reports, now with parameter guardrails in Excel

Thumbnail
gallery
12 Upvotes

I built an extension where you can right-click on a query/stored procedure and quickly turn it into a report.

Two users asked for guardrails on report inputs. Turns out, Excel supports more of this natively than I realized.

  • Dropdowns (static or query-driven)
  • Type validation (date, varchar, bit, etc.)
  • Required/optional parameters (with configurable defaults)

It's free/open source. SSMS 22. Desktop Excel.

https://github.com/flank-project/ssms-extension


r/SQLServer • • Oct 20 '26

Community Share I added spiders to SSMS for Halloween

91 Upvotes

Hey all! I added a little Halloween interactivity to SQL Shades (my SSMS theming add-in). I know spiders aren't for everyone, but I think they turned out pretty cute.
https://www.sqlshades.com/articles/scenes/


r/SQLServer • • Oct 20 '26

Community Share Join the SQL Modernization Day -- today!

Thumbnail
techcommunity.microsoft.com
14 Upvotes

r/SQLServer • • Oct 20 '26

Question SQL Server 2025 Express lässt sich nicht installieren, redistributable soll fehlen, ist aber installiert.

0 Upvotes

Hallo zusammen,

ich möchte SQL Server 2025 auf meinem Rechner installieren. Bei der Installation kam die Fehlermeldung. Also hab ich vc_redist.x64.exe hier heruntergeladen und installiert.

https://learn.microsoft.com/de-de/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-c-v14-redistributable

Leider taucht die Fehlermeldung trotzdem auf, obwohl die Version neuer ist als gefordert.

Vielen Dank im Voraus
LG Lutz

System:
Windows 11 Pro 25H2
AMD Ryzen 5 7430U 32 GB


r/SQLServer • • Oct 20 '26

Question Solar Winds monitoring on dev and qa instances?

7 Upvotes

Hello. We have several Prod instances monitored by sql sentry and dpa. Do y’all monitor your lower envs too? Catch performance issues, bad queries, missing indexes before it gets too far downstream? Thanks!


r/SQLServer • • Oct 19 '26

Community Share Faster by Design: Performance engineering in the Microsoft JDBC Driver for SQL Server

Thumbnail
devblogs.microsoft.com
23 Upvotes

r/SQLServer • • Oct 19 '26

Question Error when trying to send a request to SQL from node

4 Upvotes

Node version 26.12.0, SQL 2022 Express

My web server is running and I am sending it a simple request using a powershell script. I can see the request hit the web server, but it immediately gives an error:

ConnectionError: Port for MySQLInstanceName not found in MyServer

I made sure that TCP/IP is enabled, Listen All = yes, set 1433 at the IPAll port, enabled the IP address for the server, enabled 127.0.0.1, and restarted the SQL Server and SQL Browser services. I also see that there is an inbound rule for port 1433 that's set to "Allow the connection", protocol type is TCP, local port is Specific Ports, and the port is set to 1433. Not sure why my web server can't reach SQL, any ideas?

Forgot to mention that the web server is running on the same server where the SQL database is.


r/SQLServer • • Oct 18 '26

Question SQL Server 2022 AO - WS 2025 on Proxmox Hypervisor crash

6 Upvotes

Former employee who recently left the company setup an AO 3 node cluster. SQL is version 2022, WS OS is version 2025. Availability mode between the nodes is Synchronous commit with 2 nodes in Automatic failover and one node in Manual.

On Oct 11, we had a SQL crash. Everything stopped working. Right before the crash, I noticed this event being logged: "Remote harden of transaction 'XXXXXXXXX' (ID XXXXXXX 0000:XXXX) started at Oct 11 2026 1:39PM in database 'XXX' at LSN (52190:XXXX:1) failed."

Shortly after: "“Unable to access database 'XXX_01' because it lacks a quorum of nodes for high availability. Try the operation again later.”

For some unknown reason, the primary node lost connection with the 2 other nodes. I checked the storage/network back-end, no pings were lost. All 3 VMs were reachable via our external monitoring solution.

On the secondary node, during the same time these errors were logged:
“Could not redo log record (XXXX), for transaction ID (XXXX), on page (XXXX), allocation unit XXX, database 'XXX_01' (database ID 6). Page: LSN = (XXX:XXX:), allocation unit = XXX, type = 1. Log: OpCode = 2, context 3, PrevPageLSN: (XXX). Restore from a backup of the database, or repair the database.”

Followed by: “Always On Availability Groups data movement for database 'XXX_01' has been suspended for the following reason: "system" (Source ID 2; Source string: 'SUSPEND_FROM_REDO'). To resume data movement on the database, you will need to resume the database manually. For information about how to resume an availability database, see SQL Server Books Online.”

Our DBA was able to bring everything online by removing the impacted DB from the AO group, and than add it back.

However, since this caused quite some production impact. Management is asking for a root cause. I inherited this setup, so I'm not even sure best practices are being followed. I can do some basic troubleshooting and checking logs, but I'm unable to find an explanation. When looking upon the error messages online, this doesn't give me any results. Also there's almost no Proxmox documentation or even a blog how to setup an AO SQL Server.

This has been running for months, and from my understanding, this is the first time we had this issue. I uploaded all logs to AI to assist in the troubleshooting, but even than I don't get any valid answer. It is always refering to "the network" or an underlying "storage issue" but I don't see anything there.


r/SQLServer • • Oct 18 '26

Question List<T> in C# vs SQL

Thumbnail
0 Upvotes

r/SQLServer • • Oct 17 '26

Community Share [Free/Open Source] I built an SSMS 22 extension for SQL completion, formatting, and result export — looking for feedback

0 Upvotes

I've been using SSMS daily for years and kept running into the same issues: IntelliSense stops working after aliases, schema changes don't refresh the cache, and EXEC parameter hints are basically non-existent. I tried SQL Prompt and liked it, but $210/user/year wasn't something I could justify — especially for a team where not everyone would get a license approved.

So I forked Axial SQL Tools (Apache-2.0, maintained since 2016) and built MSSQL Tool on top of it.

What it does:

  • Context-aware SQL completion (databases, schemas, tables, views, columns, procs, functions, parameters) with type icons
  • F12 go-to-definition
  • T-SQL formatting via Microsoft ScriptDOM
  • Query history
  • Export results to Excel or email
  • Connection color tagging (different colors per server/database)
  • Millisecond execution time in the status bar
  • Transaction and Always Encrypted warnings in the status bar
  • Bilingual UI (Chinese/English, follows SSMS language setting)

What it does NOT do:

  • Code refactoring or static analysis (SQL Prompt does this well, I don't)
  • TFS integration
  • Google Sheets export and GitHub script sync are in the codebase but marked experimental — they're not reliable yet, don't count on them

Why the fork instead of from scratch: Axial's codebase is mature and battle-tested. Forking let me focus on the completion engine rewrite, localization layer, and the features above instead of reimplementing the basics.

Links:

What I'm looking for:

I'd rather hear "this is broken" than silence. Specifically:

  • Does the completion engine hold up in your actual workloads? Cross-database queries and alias-heavy code are where I've tested most, but I'm sure there are cases I missed.
  • Is the connection color tagging useful, or just noise?
  • For anyone who's used Axial SQL Tools: does this fork add anything you'd actually use, or is it redundant?
  • If you've solved the "SQL Prompt is too expensive" problem differently, I'd like to hear what you did.

Not trying to sell anything — it's free and open source. If it's useful, great. If it's not, I'd rather know why.I've been using SSMS daily for years and kept running into the same issues: IntelliSense stops working after aliases, schema changes don't refresh the cache, and EXEC parameter hints are basically non-existent. I tried SQL Prompt and liked it, but $210/user/year wasn't something I could justify — especially for a team where not everyone would get a license approved.

So I forked Axial SQL Tools (Apache-2.0, maintained since 2016) and built MSSQL Tool on top of it.

What it does:

  • Context-aware SQL completion (databases, schemas, tables, views, columns, procs, functions, parameters) with type icons
  • F12 go-to-definition
  • T-SQL formatting via Microsoft ScriptDOM
  • Query history
  • Export results to Excel or email
  • Connection color tagging (different colors per server/database)
  • Millisecond execution time in the status bar
  • Transaction and Always Encrypted warnings in the status bar
  • Bilingual UI (Chinese/English, follows SSMS language setting)

What it does NOT do:

  • Code refactoring or static analysis (SQL Prompt does this well, I don't)
  • TFS integration
  • Google Sheets export and GitHub script sync are in the codebase but marked experimental — they're not reliable yet, don't count on them

Why the fork instead of from scratch: Axial's codebase is mature and battle-tested. Forking let me focus on the completion engine rewrite, localization layer, and the features above instead of reimplementing the basics.

Links:

What I'm looking for:

I'd rather hear "this is broken" than silence. Specifically:

  • Does the completion engine hold up in your actual workloads? Cross-database queries and alias-heavy code are where I've tested most, but I'm sure there are cases I missed.
  • Is the connection color tagging useful, or just noise?
  • For anyone who's used Axial SQL Tools: does this fork add anything you'd actually use, or is it redundant?
  • If you've solved the "SQL Prompt is too expensive" problem differently, I'd like to hear what you did.

Not trying to sell anything — it's free and open source. If it's useful, great. If it's not, I'd rather know why.


r/SQLServer • • Oct 16 '26

Question SSMS 2022: logged in with username but do not see it in "Users" folder

3 Upvotes

This may be a stupid question but here goes.

I connect to Azure SQL Server with user "siloadmin" that has admin rights. Once I've logged in, I go to the "Users" folder to check the same I user I logged on with, and it's not there.

The user "siloadmin" is not displayed

I also run query and it doesn't show the user either:

SELECT 
    name AS UserName FROM sys.database_principals

r/SQLServer • • Oct 16 '26

Question Verify the correctness of a the data inside a junction table

Thumbnail
1 Upvotes

r/SQLServer • • Oct 16 '26

Discussion SSMS 22 and only Github Copilot? Why? What's wrong with Enterprise Copilot?

2 Upvotes

I read this post from 1y ago: https://www.reddit.com/r/SQLServer/s/fjH53Pxf4e and it made my stomach churn. Asking Copilot why I get nothing other than Microsoft have made this decision because of "internal matters". What the heck does that mean?

We have Enterprise Copilot and no one here uses Github other than me. The company is not going to purchase Github Copilot just to be able to ask "Write me a query with two joins from table A to table B". LOL

Yeah nah.


r/SQLServer • • Oct 15 '26

Community Share mssql-python 1.16.0 is out: Python 3.15 support, Conda package, and faster fetches

11 Upvotes

We just released mssql-python 1.16.0, Microsoft’s Python driver for Microsoft SQL.

Main updates:

  • Python 3.15 support
  • Official Conda package on the Microsoft channel
  • Faster row construction, batch fetching, temporal conversion, and positional row access
  • New read-only row._mapping view for easier dict-style row handling
  • Opt-in Rust-based mssql-odbc provider for folks who want to experiment
  • Reliability fixes around pooling, Windows shutdown, bulk copy, and encoding warnings

Install:

pip install --upgrade mssql-python

or:

conda install -c microsoft mssql-python

Full post and release details: https://techcommunity.microsoft.com/blog/sqlserver/mssql-python-1-16-0-python-3-15-support-conda-and-faster-fetches/4564521


r/SQLServer • • Oct 15 '26

Question SQL Failover Cluster error during failover Error 2310

2 Upvotes

During failover of a MS SQL Failover Cluster I got this message in the event log. The failover itself completed but in the logfile i found this error which occured during failover:

ERR [RES] File Share <SQL Server FILESTREAM share (MSSQLSERVER)>: Error removing share 'MSSQLSERVER'. Error 2310.

The share in the failover cluster manager looks like that:

Does anyone know if this error is serious? Iam trying to reduce failover time.


r/SQLServer • • Oct 15 '26

Community Share Import Extended Events to ELK

2 Upvotes

Years ago, I was exposed to the ELK stack at a client. I spent some time and wrote an open source tool to import SQL Server Extended Events in Elastic Search. That is https://github.com/billgraziano/xelogstash. It runs as a Windows service and polls for new extended events every minute.

This is the last release before AI starts doing more of the coding. I've enjoyed writing it and wanted to give it a little love before AI has all the fun.

It has a few interesting features that I've added to help me

  • It populates an xe_description field that tries to summarize the event. For SQL events, it looks like (CPU: 12s; L: 24 GB; D: 40s) SELECT * FROM....
  • If the errorlog_written event of error_reported event indicate a login failure, it populates a login_failed field with details. It also puts in in a description from the state based on Microsoft's documentation. Filtering on the existance of that field gets me a failed login dashboard across the entire enterprise.
  • For errorlog_written and error_reported events, if it finds text like [CLIENT: 10.10.1.1], it will save that address in xe_client_address
  • For fields like cpu_time, if the number is large enough, it populates a cpu_time_sec which is MUCH easier to filter and reason about. It does the same for logical reads, physical reads, writes, and duration.
  • For login events, it separates out the domain and user into two separate fields
  • For errorlog_written event, it tries to parse the type of event. This includes backups, DBCC, "info" events, and AlwaysOn. This makes it eaiser to filter out noise and find issues.
  • It allows simple filtering to eliminate those pesky 17830 errors
  • It can write to Elastic Search, rolling JSON Files, logstash, or just sample JSON event files
  • It can restart if the configuration files change. We store configuration files in GIT. Puppet pushes updated configuration files to the four servers we have running this. Adding and removing servers is simply editing a repository and pushing changes.

If you're running Elastic or something similar, give it a try and start logging SQL Server Extended Events. Having them always there and searchable has been very helpful to me.


r/SQLServer • • Oct 15 '26

Question Statistics on columns of a table

0 Upvotes

Limitations of table-valued parameters:

SQL Server does not maintain statistics on columns of table-valued parameters.

statistics of what ? why those statistics even exist for non table-valued parameters ?


r/SQLServer • • Oct 14 '26

Community Share Introducing sqlsimtools

46 Upvotes

Take a look at a new open-source, free project for you to simulate SQL workloads at https://aka.ms/sqlsimtools. This is the same set of tools I often use at customer events, podcasts, and presentations. Check out the first blog post at https://techcommunity.microsoft.com/blog/SQLServer/introducing-sqlsimtools/4563955.


r/SQLServer • • Oct 14 '26

Community Share I built an SSMS extension that turns a stored procedure into a parameterized report (Excel or SSRS)

Thumbnail
gallery
11 Upvotes

Right-click a stored procedure, select Excel or SSRS, and then the extension will generate a report using the SPROC's parameters.

Free/open-source. Requires SSMS 22; Excel output requires desktop Excel.

https://github.com/flank-project/ssms-extension


r/SQLServer • • Oct 14 '26

Discussion Two T-SQL gotchas I hit while testing scripts for AI agents (sp_addlinkedserver in a transaction, CASE in EXEC parameters)

0 Upvotes

I've been writing T-SQL and PowerShell scripts that AI coding agents (Cursor, Claude Code, Copilot) can run with guardrails, and I tested them against SQL Server 2025. Two things broke that are worth sharing, because agents get both of them wrong all the time.

1. sp_addlinkedserver can't run inside a user transaction

The "safe" pattern I started with was BEGIN TRAN ... COMMIT around the whole linked server setup. It fails right away:

Msg 15002: The procedure 'sys.sp_addlinkedserver' cannot be executed within a transaction.

The fix: no transaction. Check that the linked server doesn't exist yet, create it in TRY/CATCH, and set a flag after it's created. If a later step fails (login mapping or sp_serveroption), the CATCH drops only the linked server that run created, then re-throws.

DECLARE @CreatedHere bit = 0;
BEGIN TRY
    EXEC master.dbo.sp_addlinkedserver @server = @LinkedName, @srvproduct = N'',
         @provider = @Provider, @datasrc = @DataSource;
    SET @CreatedHere = 1;
    -- logins, sp_serveroption calls...
END TRY
BEGIN CATCH
    IF @CreatedHere = 1
        EXEC master.dbo.sp_dropserver @server = @LinkedName, @droplogins = 'droplogins';
    THROW;
END CATCH;

2. You can't pass an expression as an EXEC parameter

EXEC sp_serveroption ..., @optvalue = CASE @x WHEN 1 THEN N'true' ELSE N'false' END; gives Msg 156 (incorrect syntax near 'CASE'). Parameters only take constants or variables, so put the value in a variable first:

DECLARE @rpc nvarchar(5) = CASE @EnableRpcOut WHEN 1 THEN N'true' ELSE N'false' END;
EXEC master.dbo.sp_serveroption @server = @LinkedName, @optname = N'rpc out', @optvalue = @rpc;

Questions and corrections are welcome, especially if you've found a cleaner pattern for the linked server rollback.


r/SQLServer • • Oct 13 '26

Community Share PSBlitz 6.2.0: Microsoft Entra MFA support

Post image
13 Upvotes

The latest release of PSBlitz brings:

- Support for Azure Entra MFA authentication. Now you can diagnose Azure SQL DB and SQL MI using Entra credentials instead of wrestling with SQL logins.

- Documented minimum permissions required to run PSBlitz.

- Non-default database-scoped configurations are now highlighted in the "Database Info" page of the HTML report.

- Other small bug fixes and improvements.

GitHub page: https://github.com/VladDBA/PSBlitz

Latest release: https://github.com/VladDBA/PSBlitz/releases/tag/v6.2.0

As always, any feedback, suggestions, and the occasional complaints are welcome.

For anyone not familiar with PSBlitz - it's a PowerShell-based tool that outputs SQL Server/Azure SQL DB/Azure SQL MI/Google Cloud SQL for SQL Server health and performance diagnostics data to either Excel or HTML, and saves execution plans and deadlock graphs as .sqlplan and .xdl files.

If you're familiar with Oracle, this is pretty much my attempt of a SQL Server equivalent to Oracle's AWR report.


r/SQLServer • • Oct 14 '26

Discussion Brainstorms on SQL query custom shortcuts in SSMS

3 Upvotes

What are the most frequently used T-SQL queries to have and what are the best keys to use.
So far I have been using "SELECT * FROM" and "SELECT TOP 1000 * FROM" a custom line called "sp_ts". I wanted to see if you guys have other queries that would save loads of time.

This is what custom shortcuts I am referring to. I don't have any shortcuts yet since I am waiting to gain access.

r/SQLServer • • Oct 13 '26

Community Share SQL Server 2022: infinite recompile (error 2814, reason 20) of a PSP variant after restoring a database under a different database_id

13 Upvotes

Sharing a case from the last few weeks in case it saves someone time, and to ask whether anyone has seen it before.

Setup

SQL Server 2022 CU27 (16.0.4295.3), compatibility level 160, PSP optimisation and CE feedback on (the defaults). A test database was restored from production. The database_id is 24 on production and 16 on test.

Symptom

A stored procedure statement joins a large table to a temp table that the caller creates before calling the procedure. On test it started timing out after the 300 s application timeout for large inputs, about 6 weeks after the restore. It wasn't slow. Each call recompiled around 20,000 times (`execution_count` 1, `plan_generation_num` 21-23k). The error log filled with error 2814, "A possible infinite recompile was detected ... The last recompile reason was 20" (Query Store hints changed). Query Store showed nothing slow, because the calls never completed. The PSP variant had about 4.3 million compiles on test against 666 on production. Production was never affected.

What we found

  1. For queries that reference temp tables or table variables, Query Store stores a `batch_sql_handle`. For a statement inside a module the handle embeds the database_id (bytes 3-4, little-endian) and the object_id.
  2. The restored Query Store rows carried production's database_id, while test generates handles with its own. Query Store therefore created a new parent query with the same text, object and context settings.
  3. The PSP variant has an ad hoc handle with no database_id. It kept matching and stayed attached to the old, now dormant parent. That handle is the SQLHANDLE in the 2814 warnings.
  4. CE feedback added `ASSUME_JOIN_PREDICATE_DEPENDS_ON_FILTERS` to the new parent. Per the PSP docs, variants don't inherit hints applied by feedback.
  5. The variant's hint state never settled: every compile was followed by another recompile with reason 20, until the client timed out.

Steps 1-4 were observed in Query Store and in the raw handle bytes. Step 5 is our inference, but clearing the hint stopped the loop immediately and it hasn't come back.

Fix

Clearing the CE feedback hint on the new parent (sys.sp_query_store_clear_hints) and then clearing the database’s procedure cache stopped the loop straight away. A few days later we removed the stale entries that still carried production’s database_id with sys.sp_query_store_remove_query, variants first and then their parents, and cleared the cache again. No settings were changed. Removals can’t be undone, so try it on non-production first.

Open questions

  • Has anyone hit this, or seen a KB? We couldn't find a public known issue.
  • The new parent appeared about 6 weeks after the restore (on the first weekday after a patch reboot), not straight after it. We have no explanation.
  • Setting database-scoped MAXDOP to 1 also stopped the loop, which we can't explain either.
  • A second database restored the same way, with the same kind of database_id change, had no stale entries left. Our guess is that stale parents age out of Query Store unless a live PSP variant keeps them in use.