336,251 questions
Score of -5
2 answers
154 views
Prefix of string up to first numeric value
I have a formula in Excel that I'm looking to recreate in SQL Server (T-SQL). Basically, I need to return the prefix of the string up to the first numeric value as one data point and everything from ...
Score of 3
2 answers
172 views
Is splitting rarely-queried wide columns into a separate table a sound way to speed up scans on unindexed columns?
I know larger rows scan slower in the trivial sense (more bytes = more I/O). My question is specifically about one design choice: whether splitting rarely-needed wide columns into a separate table is ...
Score of 0
0 answers
127 views
Upgrading SSIS 2025 to .NET Framework 4.8 keeps reverting to 4.7
I am trying to upgrade my SSIS 2025 projects to use .NET Framework 4.8. I'm currently using .NET 4.7 successfully.
I have Visual Studio 2022 64-bit v17.14.7. My target server version is SQL Server ...
Score of 0
3 answers
129 views
When dropping & recreating a table with the same name, do associated objects (stored procedures, views, triggers) handle that?
I need to drop and recreate a table (with the same name) in an existing database.
Will the various objects in the database that reference that table work fine after the table drop/recreate? (eg., ...
Score of 2
2 answers
236 views
How can I exclude holidays using my custom holiday table in my SQL code that excludes weekends
I have completed my SQL code to exclude weekends, but how can I incorporate my dbo.Holidays table into my code to exclude those dates from being added to the 3 days?
In below example, for ContactID = ...
Score of -3
1 answer
198 views
How can SQL Server populate the foreign key value automatically, so I don't have to manually? [closed]
In my application an Admin user is authorized to access the AdminPanel view or page. The AdminPanel is initially empty; it does not show products. An Admin can click some button on the AdminPanel that ...
Score of 0
1 answer
82 views
Configuring foreign key using Fluent API does not work
The screenshot shown below shows the tables along with the existing relations between them, as well as the new connections or relations that I want to create: I want to add two one-to-many ...
Score of 1
0 answers
174 views
EF Core migration fails with SqlException: there is already an object named 'Courses' in the database after resetting migrations
I am experiencing an issue in Entity Framework Core when trying to apply a newly generated initial migration to an existing SQL Server database.
Scenario & steps taken:
I wanted to start fresh ...
Score of -4
0 answers
140 views
How do I escape an SQL Server database name that contains brackets []? [duplicate]
Let's say I have a SQL Server 2025 database named [test] (which, surprisingly, is a valid name).
Since brackets act as quoted identifiers, trying to reference it with USE [test] gives the error:
...
Score of -3
2 answers
149 views
How to export SQL Server database from SSMS and be able to use it in my C# application [closed]
I have a Winforms application which contains a model-like class purely for SQL Server file management/queries execution. For some reason no matter what I do my program freezes when I hit SqlConnection....
Score of 2
1 answer
126 views
Dynamic Data Masking doesn't work with UNION
While applying the Dynamic Data Masking (DDM) features to some of my SQL Server 2019 tables, I came across an unexpected behavior.
I have two tables containing the same data, each with a single column ...
Score of 0
2 answers
114 views
Create an XML file with multiple XMLNS and multiple nesting in SQL
I am trying to have our SQL system generate a XML file that fits a pre-determined XML layout.
RDBMS is SQL Server 2008 - SQL Server 2019
I need the layout to be in the format of:
<Root xmlns="...
Score of 3
1 answer
144 views
How do I prevent violation of UNIQUE KEY constraint caused by lots of inserts coming from 2 sessions
I wrote this stored procedure to recreate a production failure I see. I stripped it down while still causing the issue.
It does an update or insert on 100 rows. It's executed in a transaction that ...
Score of 0
1 answer
143 views
How to query row based data and left join it?
We have a table which stores lots of data. Sometimes, we will need to add new columns. As more and more columns added, we think maybe should convert this table to row based.
The Event table is similar ...
Score of -2
0 answers
95 views
SSIS 2025 Incompatible Application Not Found Error
I am trying to upgrade SSIS 2022 solution to SSIS 2025.
We have a SQL Server 2025 instance with SSIS installed. I have both Visual Studio 2022 and 2026 installed.
I can open the solution in VS 2022 no ...