4,690 questions with Transact-SQL-related tags

Sort by: Updated
2 answers

Transaction Log Cannot Be Truncated After Memory-Optimized Filegroup Removal

Hello there, One of our clients is facing an issue with a database where the memory-optimized filegroup was forcibly removed using DBCC CHECKDB (test, REPAIR_ALLOW_DATA_LOSS). The database remains functional, but the transaction log continues to grow and…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-02-11T04:59:42.99+00:00
kedar giri 81 Reputation points
answered 2025-02-11T22:54:49.09+00:00
Erland Sommarskog 116.6K Reputation points MVP
3 answers

Sortable MVC Tables with Stored Procedure

Hello everyone and thanks for the help in advance. I am developing a MVC application that requires a sortable table. The issue is that the tables utilize queries that are best suited for stored procedures. While researching, I cam across older…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,778 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-02-06T18:27:54.7366667+00:00
Kmcnet 946 Reputation points
answered 2025-02-07T00:18:33.88+00:00
SurferOnWww 3,816 Reputation points
3 answers One of the answers was accepted by the question author.

How granting the execute permission for several stored procedures - SQL Server 2019

Hi, in order to review some security aspects about a SQL Server 2019 instance I need to assign the execute permission for several stored procedures to a db_datareader and db_datawriter user without operating one by one. How could I accomplish a such…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-02-03T08:18:41.0633333+00:00
pmscorca 1,032 Reputation points
edited a comment 2025-02-06T21:51:17.2166667+00:00
Erland Sommarskog 116.6K Reputation points MVP
3 answers One of the answers was accepted by the question author.

Best practices for joining tables of different collation property database

Hi, I am trying to join two tables of databases present on same server but with different collation property and getting following error: What are the best practices to join tables of different databases present on same server but with different…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-30T10:48:40.5633333+00:00
Priya Jha 896 Reputation points
accepted 2025-02-05T12:21:45.1733333+00:00
Priya Jha 896 Reputation points
2 answers One of the answers was accepted by the question author.

Scalability LEFT JOIN vs MERGE

Hi there, I'm UPSERTING AND handling 70 + millions of rows of UPSERT. I'm the only developer on the DB. GP_Gen5_6 LEFT JOIN DURING UNIT TEST OF ALL RECORDS 12 mins SCALED UP OVERNIGHT PROCESS GP_Gen5_20 History of existing MERGE process same operation…

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-28T17:04:24.43+00:00
RJ 306 Reputation points
edited the question 2025-02-05T01:23:44.56+00:00
ZoeHui-MSFT 40,511 Reputation points
2 answers

How to access skillpipe.com site

Hello, A few years ago I took a Microsoft course related to Transaction-SQL. All learning materials were provided by instructors from skillpipe.comsite. I liked it very much.. Obviously I have an account to access it. Now I can’t access it. I used this…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-02-02T14:02:06.0366667+00:00
Susja 716 Reputation points
answered 2025-02-04T02:19:34.9166667+00:00
LiHongMSFT-4306 30,666 Reputation points
1 answer

Breakdown text into multiple records

Greetings... I'm working on a SQL Server query where I have to breakdown text stored in Comments column which is of datatype varchar(max) into multiple records. For instance, if there are 280000 characters in the Comments column then it should be…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-02-03T06:27:58.5266667+00:00
Raj D 591 Reputation points
commented 2025-02-04T02:09:15.3033333+00:00
LiHongMSFT-4306 30,666 Reputation points
3 answers One of the answers was accepted by the question author.

An expression of non-boolean type specified in a context where a condition is expected

Hi, I have an issue with this stored procedure (code below), it returns me the following error: An expression of non-boolean type specified in a context where a condition is expected, near 'seque'. Can you please help me with it ? Thank you DECLARE…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2021-05-07T11:06:17.85+00:00
Naami.Ayman 331 Reputation points
commented 2025-01-30T08:11:43.1366667+00:00
Moses Ogada 0 Reputation points
2 answers One of the answers was accepted by the question author.

Select with Conditional COUNT

Hello everyone and thanks for the help in advance. In a prevous post https://learn.microsoft.com/en-us/answers/questions/2148980/counting-occurrences-in-a-table, Erland Sommarskog built a query for me that counted the occurrences of vaccines by patient.…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-27T23:07:18.69+00:00
Kmcnet 946 Reputation points
commented 2025-01-28T22:08:15.4233333+00:00
Kmcnet 946 Reputation points
2 answers

Invalid object name 'STRING_SPLIT' in SQL Server 2019

Hi Support, Our SQL server version is 2019 and check the compatibility level is 150, but it still have error "Invalid object name 'STRING_SPLIT' ". We also tried the case sensitive according to this link, both of them have the same error. …

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2022-04-04T02:26:23.81+00:00
Chong 871 Reputation points
commented 2025-01-27T07:14:17.7333333+00:00
Jindra 0 Reputation points
1 answer One of the answers was accepted by the question author.

How to figure out the total number of doses within a time span given to a client as dose are being added and stopped.?

If the cadence values are different, even if the dates overlap the records must be separate. If an order for the same dose and cadence value (including nulls) starts on the same day or the next day (+or-1 day) the record should continue. outlook of…

Azure SQL Database
SQL Server Transact-SQL
SQL Server Transact-SQL
SQL Server: A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.Transact-SQL: A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
114 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2024-07-22T22:24:04.8633333+00:00
andrew omofonma 61 Reputation points
edited the question 2025-01-27T04:28:08.7933333+00:00
Rakesh Gurram 11,965 Reputation points Microsoft Vendor
3 answers One of the answers was accepted by the question author.

Run SQL Statements Parallel within a SP

Hi there, Is there a way to run SQL Statements in parallel within the same SP? Thanks for your time. CREATE PROCEDURE CustomerPARALLEL AS BEGIN EXEC DBO.CUST1 - TAKES 20 MINS (INDEPENDENT) EXEC DBO.CUST2 - (TAKES 20 MINS (NO DEPENDENCY)) HOW TO…

Azure SQL Database
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-22T18:28:57.0533333+00:00
RJ 306 Reputation points
answered 2025-01-25T22:29:15.7166667+00:00
Erland Sommarskog 116.6K Reputation points MVP
10 answers One of the answers was accepted by the question author.

Microsoft SQL Server Studio - Dark Mode

Is there any official method to use Microsoft SQL Server Management Studio Studio with Dark Mode?

Azure SQL Database
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,424 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2023-12-19T13:11:52.4966667+00:00
Kıvanç ÖZDEMİR 135 Reputation points
answered 2025-01-25T19:04:25.2733333+00:00
Joshua Moonstar 0 Reputation points
0 answers

How to get a CSV file from a T-SQL in SQL Agent

I am using SQL agent to schedule a task. This task is the execution of a script that performs a query to several databases and concatenates the output. I have managed to obtain a file but not a CSV file, that is, I cannot obtain a file separating the…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2024-09-26T13:24:49.4666667+00:00
LUIXANY COLISEE 0 Reputation points
commented 2025-01-24T16:40:24.2966667+00:00
GlockByte 161 Reputation points
1 answer

SQL gaps and island issue

Greetings!!! We're working on migrating data from a legacy application and have a requirement to get all the consecutive SESSION START_DATE & END_DATE. For the SESSION_ID - 8642, SESSION_TYPE - 3256, based on the requirement using sql server query…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
SQL Server Transact-SQL
SQL Server Transact-SQL
SQL Server: A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.Transact-SQL: A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
114 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-21T05:59:20.4966667+00:00
Raj D 591 Reputation points
commented 2025-01-23T22:35:07.0133333+00:00
Erland Sommarskog 116.6K Reputation points MVP
1 answer One of the answers was accepted by the question author.

A Simple SQL Query

I have the following table:- I want Col 1 and Col 2 where Col2 =1 and the corresponding all the values of Col 1 where Col 1 =2. But this is an example. I can find 1st part (i.e,, Select Col1, Col 2 from Table1 where Col 2 =1). But my problem is how do…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
SQL Server Transact-SQL
SQL Server Transact-SQL
SQL Server: A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.Transact-SQL: A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
114 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-21T14:07:34.2966667+00:00
chuck DM 101 Reputation points
commented 2025-01-22T07:23:58.6166667+00:00
Olaf Helper 45,881 Reputation points
3 answers One of the answers was accepted by the question author.

Find ALL UNUSED columns on SQL DB Tables

Hi there, Is there a way in AZURE SQL Server to find all columns of a table which are NOT used by ANY SPs or Views. I have 65000+ columns in DB based on information schema columns. I do see 200+ SPs of which not all columns are used. Some have select *…

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-21T17:05:11.6733333+00:00
RJ 306 Reputation points
accepted 2025-01-21T22:18:50.0366667+00:00
RJ 306 Reputation points
1 answer

How to write a Simple TSQL

I have the following table:- I have two requirements. the 1st one is, I need ColA and ColB when ColB is 1. So the query would be:- Select ColA, ColB from Table1 where ColB =1. The Output of the 1st requirement is:- Now the 2nd requirement is, as the…

SQL Server Transact-SQL
SQL Server Transact-SQL
SQL Server: A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.Transact-SQL: A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
114 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-21T14:52:01.98+00:00
chuck DM 101 Reputation points
edited an answer 2025-01-21T14:56:51.59+00:00
Viorel 119.7K Reputation points
1 answer One of the answers was accepted by the question author.

UPSERT - CAPTURE UPDATED ROWS INTO ANOTHER AUDIT TABLE

Hi there, I'm trying to do soft delete on a target table which are not in source. Basically if the ID is not in source but ID is in target, update that RecordStatusKey of that specific target ID. I would like to capture the records updated in merge. Is…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,458 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-20T17:01:10.7433333+00:00
RJ 306 Reputation points
accepted 2025-01-20T22:57:55.0666667+00:00
RJ 306 Reputation points
1 answer One of the answers was accepted by the question author.

Counting Occurrences in a Table

Hello everyone and thanks for the help in advance. I need to develop a MVC application that reads a SQL database of patients who have received vaccines. The table looks like: [ID] [int] IDENTITY(1,1) NOT NULL, [MRNumber] [varchar](50)…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,778 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,690 questions
asked 2025-01-19T02:44:58.7666667+00:00
Kmcnet 946 Reputation points
accepted 2025-01-20T19:59:16.7966667+00:00
Kmcnet 946 Reputation points