4,656 questions with Transact-SQL-related tags

Sort by: Updated
1 answer

tsql sum amount recursively without recursive cte

Hi, I need help creating recursive query to sum up Amounts of all ChildIDs for parent ID=1 node. Table definition and data below. This is for SQL serverless where Recursive CTE is not supported. So left join would do, The table is large and the 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.
13,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
asked 2024-11-07T18:28:16.3166667+00:00
Julia9534 1 Reputation point
edited the question 2024-11-08T13:58:12.25+00:00
Julia9534 1 Reputation point
1 answer

SQL Server Login with view to only one database

Hi I have a request to create a SQL account on my Instance of SQL 2014 I want the user to connect to instance - Done And have read write access to only 1 schema - Done view only 1 database - Not working out How i can i restrict user to see only 1…

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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
asked 2024-11-08T10:01:41.47+00:00
SSinhg 286 Reputation points
commented 2024-11-08T13:00:39.2566667+00:00
Olaf Helper 45,106 Reputation points
0 answers

Using Temporary Tables and Re-Using Temporary Tables in a SSRS Report

So we need to standardize Member Eligibility by using a SQL Server Stored Procedure that will be called, Executed by our Patient/Member SSRS Reports. The SQL Server Stored Procedure currently uses a Global Temporary Table to pass its result set back 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.
13,998 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,940 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
asked 2024-11-07T13:49:08.8166667+00:00
Bobby P 231 Reputation points
edited the question 2024-11-08T08:24:32.69+00:00
ZoeHui-MSFT 37,671 Reputation points
2 answers One of the answers was accepted by the question author.

Split one column into multiple column

Dear my friends, I have a question about how to split one column into multiple column ? I've try the code but it doesn't work Does anyone could help me ? Thank You for your help Best Regards, Steve Henry

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,998 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.
102 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
asked 2024-11-08T02:30:55.4366667+00:00
Steven Henry Suhendra 20 Reputation points
commented 2024-11-08T07:02:36.26+00:00
Steven Henry Suhendra 20 Reputation points
1 answer

How to covert UTC time to CST

I have a dataset recorded in UTC format. I want to covert it and add a field as CST. I used convert(datetime, switchoffset(convert(datetimeoffset, @UTCTime), datename(TzOffset, sysdatetimeoffset()))) to covert CST. However, I found it changed the 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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
asked 2024-11-04T22:10:18.3466667+00:00
2956 1 Reputation point
commented 2024-11-07T07:00:33.2933333+00:00
LiHongMSFT-4306 28,041 Reputation points
3 answers One of the answers was accepted by the question author.

Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Hi Team, We are getting below error while running query in SSMS: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Normally it shouldm't take more than 2 mins. But from…

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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
asked 2021-07-07T20:32:35.56+00:00
Vijay Kumar 2,036 Reputation points
commented 2024-11-06T16:40:18.92+00:00
Jia Zhuang 0 Reputation points
1 answer

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,998 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,940 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,591 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,656 questions
asked 2024-10-31T19:40:38+00:00
Harshini Reddy Bobbala 0 Reputation points
answered 2024-11-04T01:39:52.6033333+00:00
ZoeHui-MSFT 37,671 Reputation points
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,998 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,591 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
asked 2024-10-29T14:38:16.0066667+00:00
Graham Rock 20 Reputation points
accepted 2024-11-01T11:58:25.31+00:00
Graham Rock 20 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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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 28,041 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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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 28,041 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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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 3,265 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,998 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,591 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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,656 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,656 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,193 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,998 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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,998 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.
102 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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,998 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.
102 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 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.7K 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,656 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