4,705 questions with Transact-SQL-related tags

Sort by: Updated
1 answer

XTP_THREAD_POOL- lot of spids running in background when no sql workload is there.

In our L&P systems, before the actual run kickoffs we have a SOP to run rebuild indices and update statistics job. Recently we are seeing SQL memory consumption is great than 80 % even after the above jobs get completed and there is no SQL workload…

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,494 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2021-07-09T04:26:29.84+00:00
Sreeni G 1 Reputation point
commented 2025-04-25T09:03:28.1566667+00:00
Ilya 0 Reputation points
2 answers

SQL Server Update particular record in a table

DROP TABLE if exists #test create table #test ( PID int, Category varchar(100), status varchar(10) ) Insert into #test values (123,'Lessthan8','compliant'), (123,'greatherthan8','compliant'), (456,'Lessthan8','Missing'), …

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-23T19:43:53.2666667+00:00
kalyan Dhanekula 0 Reputation points
commented 2025-04-23T21:09:36.54+00:00
kalyan Dhanekula 0 Reputation points
0 answers

Last passoword updated/changed date and time in Azure SQL Database for sql logins

Hi Team, as part of compliance we are planning to generate report about when was the last time password changed/updated on all Azure sql database sql logins. Because each a every Azure SQL databases we found around 150 logins. Please provide any T-SQL

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-22T23:04:14.5866667+00:00
Vijay Kumar 2,036 Reputation points
5 answers One of the answers was accepted by the question author.

cast float to numeric

Hi! I import transactions from a table where the amount column is set to Float and some values in the column is scientific numbers (example below). I need to Cast the float column to decimal values but i cant find any solution on how to do that. Is…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2022-05-02T09:29:02.477+00:00
Olsson Arne 81 Reputation points
commented 2025-04-22T17:35:23.5266667+00:00
Efigenia Parmer 0 Reputation points
1 answer

sql query to recon data between 2 systems

--SQL query for getting data from 2 vendor systems   --Hi All, --I get data from 2 vendor systems. I need to reconcile this data and match. I have very limited fields to compare   DECLARE @vendor1 TABLE                 (                                …

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-16T16:21:05.32+00:00
Spunny 366 Reputation points
commented 2025-04-18T12:36:06.7233333+00:00
Spunny 366 Reputation points
1 answer

Group By and it's Highest Value using SQL Query

In the table below, how do I group by Unit and then get the highest value from Quantity of that group? I have put 21 in row 4 under HighestValue column since its the highest value among all records in Unit

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-16T17:41:44.86+00:00
Malam Malam 266 Reputation points
answered 2025-04-17T14:04:36.3633333+00:00
Viorel 121.3K Reputation points
1 answer One of the answers was accepted by the question author.

Group By and Running Total and Totals using SQL Query

My sql query returns the following values. How do I Group By 2. Add Running Total 3. Add Total to get it done as shown in pictured example 1, 2 and 3 below? I need 3 queries to get the following results: 1: put it in Group By to…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-15T23:06:35.75+00:00
Malam Malam 266 Reputation points
accepted 2025-04-17T12:34:17.4966667+00:00
Malam Malam 266 Reputation points
1 answer

get depends objects for ssis packages

I need to get list of objects depends in each SSIS package using SQL scripts or any other approach autoprocess. Example ssis solution have 2 packages. package1.dtsx package2.dtsx Package1.dtsx have 5 tasks and 2 are execute sql task and 3 are data flow…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-03-31T23:37:34.3866667+00:00
harinathu 6 Reputation points
answered 2025-04-16T16:26:38.6633333+00:00
Spunny 366 Reputation points
1 answer One of the answers was accepted by the question author.

How to Delete top 1 item after using CTE (Common Table Expression)

I am trying to delete top 1* item after using CTE. I have the bottom T-SQL statement which works fine with select statement on the second part. with cte as ( select *, email_cnt = count(*) over (partition by "User"), …

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-15T19:23:50.7666667+00:00
King Java 770 Reputation points
accepted 2025-04-15T21:30:05.8666667+00:00
King Java 770 Reputation points
3 answers

changing the endcoding of an attached file in sql trasaction

Hi, I have written a sql server procedure which sends the result of a query as a csv file via e-mail. SQL server generates the attached file in UTF-8 BOM encoding. I need the attached file to be generated in UTF-8 (without BOM). I tried to…

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,494 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2021-07-02T10:37:55.837+00:00
Massimo 1 Reputation point
commented 2025-04-15T11:46:28.3633333+00:00
Makhar, Haridas (Cognizant) 0 Reputation points
0 answers

Issue Submitting Module Assessment – Submit Button Not Responding

Dear Microsoft Support Team, I am encountering an issue while trying to submit my "Module Assessment" on your platform. I have already completed all the questions and selected the correct answers (as shown in the attached screenshot). However,…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-08T17:05:41.3033333+00:00
Bhautik Vaghelaa 0 Reputation points
0 answers

Moving data from one storage account to another using stream analytics is creating duplicate data

Hi, I'm using Azure databricks for data analysis and have data going into a gen2 datalake storage account which then gets moved to another using the 'write once' mode on the output. What I'm seeing is that data in the second account seems to be…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-07T13:22:38.9766667+00:00
RossPerry-7177 0 Reputation points
edited the question 2025-04-07T13:36:15.8733333+00:00
RossPerry-7177 0 Reputation points
2 answers One of the answers was accepted by the question author.

TSQL Datetime convertion from UTC to AEST

Hi, I have a dataset of around 3 years and I need to do some calculations. The issue is that the dates are in UTC format but I need to convert them into AUS Eastern Standard Time I tried AT TIME ZONE but that is not working for me since it…

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,494 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2022-08-19T04:25:25.703+00:00
Farhan Sabir 26 Reputation points
commented 2025-04-07T06:46:41.07+00:00
John Bell 0 Reputation points
2 answers

Using OPENROWSET to Export to .csv Not Inserting Rows

When I execute the code below in SSMS I receive the message X rows affected where X is the number of rows in mytable. When I open myfile.csv it remains empty except for the headers which were in the file prior to me executing the INSERT. Is there some…

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,494 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2022-01-05T19:43:51.73+00:00
David Kingston 21 Reputation points
edited a comment 2025-04-06T22:00:11.63+00:00
Sierra 0 Reputation points
1 answer One of the answers was accepted by the question author.

Execution order in a stored procedure

Hi, Need some help. Easy example. Lets say I have two store procedures, A and B, as below. CREATE RPOCEDURE dbo.A AS BEGIN; DECLARE @id int=1; WHILE(@id <5); BEGIN; EXEC sp_executesql dbo.B @id=@id …

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-01T10:31:54.2833333+00:00
Fredrik M 246 Reputation points
accepted 2025-04-03T09:02:27.79+00:00
Fredrik M 246 Reputation points
1 answer

exercise link not working

https://microsoftlearning.github.io/dp-203-azure-data-engineer/Instructions/Labs/08-Explore-data-warehouse.html This question is related to the following Learning Module

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-04-02T03:01:11.71+00:00
kumar peeyush 0 Reputation points
answered 2025-04-02T10:27:26.9333333+00:00
Naveen Kumar M 175 Reputation points
1 answer

SQL Query with group by and update

Hi, I have temp table that has data like this: DECLARE @tmp1 TABLE ( Amount money, sip varchar(12), ShortName varchar(20), Fund varchar(8), SettleDate varchar(50), TrnType varchar(12), SecDesc varchar(100), Par decimal(14,0), Price…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-03-27T22:08:53.81+00:00
Spunny 366 Reputation points
commented 2025-03-28T21:27:31.58+00:00
Spunny 366 Reputation points
4 answers

Bulk Insert from csv having issues with double quotes

Hi Team, I am using Bulk Insert to load the data from CSV into SQL Table. I have used , (comma) as a field terminator and it was working fine. But in my csv file I have the Project Manager field which has in the format as (Lastname,…

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,677 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2021-01-20T07:55:09.193+00:00
Sarath 106 Reputation points
answered 2025-03-26T22:35:31.5566667+00:00
JonBr 1 Reputation point
2 answers One of the answers was accepted by the question author.

Calculate Vehicle Engine distance, duration with respect to start and end time

Calculate Engine start time, end time, distance, duration for the vehicle CREATE TABLE Vehicle(Veh varchar(10), VDatetime datetime2, Eventtype varchar(10), Odometer int) INSERT INTO Vehicle(Veh,VDatetime,Eventtype,Odometer) VALUES('V1', '2025-01-01 10…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2025-03-20T10:26:14.3566667+00:00
Srinivasulu Kummari 20 Reputation points
accepted 2025-03-20T16:31:26.27+00:00
Srinivasulu Kummari 20 Reputation points
3 answers

Timeline for SQL agent jobs

Has anyone found a tool (other than Excel) that will build a horizontal timeline of SQL agent jobs? Had a look at various project tools what produce a Gannt but they are not really working for this. Thanks in advance.

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,705 questions
asked 2022-05-17T10:26:56.003+00:00
Dave Gray 586 Reputation points
answered 2025-03-14T09:54:31.2233333+00:00
Theo Ekelmans 0 Reputation points