4,651 questions with Transact-SQL-related tags

Sort by: Updated
3 answers One of the answers was accepted by the question author.

msdb.dbo.sp_send_dbmail running in SQL Agent

Hello I have a SSIS package that all runs fine in Visual Studio, but fails when it runs in SQL Agent, most of the Tasks work and 95% of the time the package completes successfully, it just when it hits my Execute SQL task that has msdb.dbo.sp_send_dbmail…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,589 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-29T14:38:16.0066667+00:00
Graham Rock 0 Reputation points
accepted 2024-11-01T11:58:25.31+00:00
Graham Rock 0 Reputation points
2 answers

SQL Server 2022 RTM-CU13 KB5036432 sql replication do not work on availability database of always on availability group

Hi Sir/Madam, My name is Bao Viet from Vietnam. Current im involving in a project and in that project we decide to use SQL Replication to synchronize a table to a remote SQL Server. On customer site, i have a cluster with 2 node, which were setup as…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-27T17:12:54.4833333+00:00
Bao Viet NGUYEN 0 Reputation points
commented 2024-11-01T08:32:25.9633333+00:00
Bao Viet NGUYEN 0 Reputation points
2 answers

How detecting the field that causes "string or binary data would be truncated" error

Hi, I'm working on a SQL Server 2017 (RTM-CU31-GDR) instance and I'm testing an INSERT INTO ... SELECT ... FROM ... statement that unfortunately causes a "string or binary data would be truncated" error. If possible, I'd like to save…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-31T17:10:14.1766667+00:00
pmscorca 1,007 Reputation points
answered 2024-11-01T02:07:42.5666667+00:00
LiHongMSFT-4306 27,881 Reputation points
0 answers

Unable to install sql server 2022 express on my Personal laptop. Could you please help with it? Iam struggling here. Any amount of help is appreciated

The following is the message i see in my log file Overall summary: Final result: Failed: see details below Exit code (Decimal): -2147467259 Start time: 2024-10-31 14:13:52 End time: …

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,935 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,589 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,290 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-31T19:40:38+00:00
Harshini Reddy Bobbala 0 Reputation points
1 answer One of the answers was accepted by the question author.

Collation issue when using merge

Trying to load data from TableA (Source) to TableB (Target) by Merge query. One of the columns in TableA is Latin1_General_CS_AS, while the target column in TableB is Latin1_General_CI_AS. Should I firstly change collation setting in Table B before…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-31T06:29:13.7266667+00:00
Ron 20 Reputation points
accepted 2024-10-31T08:22:00.4166667+00:00
Ron 20 Reputation points
2 answers

Select top 1 field with same table

I have written this query but its executing very slow, We have 8000 of rows and this query takes almost 10 mins to execute. If anyone can help with this query optimization will be grateful. SELECT v.iID_Event_People, CASE WHEN…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-30T10:52:47.9466667+00:00
Udal Bharti 0 Reputation points
answered 2024-10-31T01:56:17.5833333+00:00
LiHongMSFT-4306 27,881 Reputation points
2 answers

tune query in sql

Hi, How to tune below query in sql,if it has 1 billion records Select A.*,B.* from INTO TEMP TableA inner join TableB ON TableA.PersonID=TableB.PersonaID where TableA.PersonCity In ('A','B','C') and TableB.personCity in ('A','B','C'))

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.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-26T06:49:00.1066667+00:00
Vineet S 1,070 Reputation points
commented 2024-10-30T07:26:06.03+00:00
NIKHILA NETHIKUNTA 2,950 Reputation points Microsoft Vendor
3 answers

IN SSIS How to change SQL Authentication to Windows Authentication

HI I was trying to deploy the packages in to server it is erroring out with the below error . TITLE: SQL Server Integration Services The operation cannot be started by an account that uses SQL Server Authentication. Start the operation with an account…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,589 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2022-05-24T17:50:21.357+00:00
Dinesh Shetty 1 Reputation point
commented 2024-10-29T20:20:55.78+00:00
Timothy Sandberg 0 Reputation points
1 answer One of the answers was accepted by the question author.

How to convert decimal into words

I want to convert amount which is in decimal to words. please help

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-29T12:26:19.0566667+00:00
Karthikeyan Vinayagam(UST,IN) 20 Reputation points
commented 2024-10-29T16:30:04.2933333+00:00
Karthikeyan Vinayagam(UST,IN) 20 Reputation points
1 answer One of the answers was accepted by the question author.

How can I make my json sql query dynamic

Hello team of experts, I have a field named MEASUREMENT_DATA_CONFIG in one of my tables named PROCESS_T that contains json code in my ms sql database catalog. Unfortunately I am not able to read the data dynamically in a clean way. If I specify the…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-28T10:50:31.87+00:00
Funke Paul 20 Reputation points
edited a comment 2024-10-28T19:06:47.7266667+00:00
Funke Paul 20 Reputation points
7 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,174 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.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2023-12-19T13:11:52.4966667+00:00
Kıvanç ÖZDEMİR 130 Reputation points
commented 2024-10-27T08:41:12.5966667+00:00
Kamran 0 Reputation points
1 answer

Correct SQL query to not repit articles

Hello, good afternoon, I have the following query in SQL and it is returning duplicate items. I managed to decipher that the items that are duplicated in the "On Orders" column in one row appear with one quantity and in the next row (Same item,…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 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.
101 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-24T18:39:13.1333333+00:00
Javier Prieto 1 Reputation point
commented 2024-10-24T23:26:16.4633333+00:00
Javier Prieto 1 Reputation point
1 answer One of the answers was accepted by the question author.

CURSOR for column in WHERE that gives dynamic columns in SELECT

Hello, I need help to make my query more simple Depends how many rows for column Code (now I have 53 rows) then it will be 53 sub selects and 53 more columns. How to make it simple to add variable in select and in sub select instead of writing 53 times…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 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.
101 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-20T20:25:46.2966667+00:00
Alan5896 26 Reputation points
commented 2024-10-21T21:20:32.78+00:00
Erland Sommarskog 112.5K Reputation points MVP
4 answers One of the answers was accepted by the question author.

Separating Name to First Name Last Name and Middle Name

Separating Name to First Name Last Name and Middle Name Have a Name Column holding a name with a format that varies case only two words exist in Name, I need to separate name into firstName and LastName and delete comma if exist case…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2022-03-19T08:51:25.15+00:00
Debilon 431 Reputation points
commented 2024-10-16T08:25:23.83+00:00
Morten Steensgaard 0 Reputation points
2 answers

How to get the non null row before the row with null value

Hi I want to see the non null row before the row with NULL value in the result set. I have data in below in format I want to see ID 2 row in the result set like below Help with this would be appreciated.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 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.
101 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-14T19:48:43.02+00:00
Learner DAX 41 Reputation points
commented 2024-10-15T18:08:31.11+00:00
Erland Sommarskog 112.5K Reputation points MVP
3 answers

Msg 22050, Level 16, State 1, Line 0 Failed to initialize sqlcmd library with error number -2147467259.

DECLARE @RowId NVARCHAR(255) DECLARE @Query NVARCHAR(MAX) DECLARE @Header NVARCHAR(MAX) SET @RowId = '[sep=,' + CHAR(13) + CHAR(10) + 'RowId]' SET @Query = 'set nocount on; SELECT ROW_NUMBER() OVER (ORDER BY PDTMO.MONo DESC, PDTWF.CreateDate ASC) AS ' +…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-06-28T05:37:28.5766667+00:00
Elson Wong 5 Reputation points
commented 2024-10-14T12:53:37.06+00:00
itspetro 0 Reputation points
2 answers

Use of Unique Index in TSQL

In TSQL what is the significance of having Unique constraints with Not Enforced enabled? Even after creating this I am able to insert duplicates within the table…

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,973 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.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-10T07:16:10.43+00:00
SRIVASTAV, SOMYA 0 Reputation points
answered 2024-10-11T02:25:39.1866667+00:00
LiHongMSFT-4306 27,881 Reputation points
1 answer

Getting last modified SQL Database

Hi expert, we've already know how to get last modified data on specific table with SQL Trigger but how do we getting last modified Database either modified data(DML) or modified table\view (DDL) inside? does anyone have query for this? great thanks…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-09T09:44:44.87+00:00
UrBel 160 Reputation points
commented 2024-10-10T20:11:25.1066667+00:00
Erland Sommarskog 112.5K Reputation points MVP
1 answer

How to get a date of day in current week

Hi, I have table that stores configurations like In my sql code, I need to take currentDateTime and get current week date for Execution Day which is Wednesday. So, for this week, it will be 10-02-2024. Get following week wednesday date. Here 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.
13,947 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.
101 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-02T17:24:40.53+00:00
Spunny 326 Reputation points
commented 2024-10-07T08:30:06.45+00:00
LiHongMSFT-4306 27,881 Reputation points
1 answer

Pivot query result (column name will change)

Hi there, Have been working on a huge database task and one part of it is the below. How do i pivot this 1 row with dynamic columns (column names will change) Query: select top 1 * from INFORMATION_SCHEMA.columns Output should be ColumnName |…

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.
13,947 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,651 questions
asked 2024-10-02T23:08:15.1166667+00:00
RJ 166 Reputation points
commented 2024-10-07T08:11:39.2033333+00:00
LiHongMSFT-4306 27,881 Reputation points