4,661 questions with Transact-SQL-related tags

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

partition by

Hi, how to add partition by in below table where there is no date key or duration..please give example here is example of sample data customerid - 1 product - grains productcategory-rice sales- 1000

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,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-11-20T20:43:21.9033333+00:00
Vineet S 1,230 Reputation points
accepted 2024-11-21T02:14:32.33+00:00
Vineet S 1,230 Reputation points
1 answer One of the answers was accepted by the question author.

performance tuning in sql

Hi, how to do a performance tuning in large set of sql data ... please help me with the steps and not link how cluster and not cluster index works in terms of disk space and memory

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,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-11-19T14:04:23.5733333+00:00
Vineet S 1,230 Reputation points
accepted 2024-11-19T22:33:11.26+00:00
Vineet S 1,230 Reputation points
2 answers

SQL Recursive query to generate output

Hello Expert , I am trying to generate one output as: Two different Tables: Table1: Cat1, Vol,Rank Cat1, 1, 1 Cat1, 4, 2 Cat1, 6, 3 Table2: Rank, Vol_Threshold, Partition 1, 21, 1 2, 27, 2 3, 34, 3 Would like to generate output: if running first…

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,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-11-18T12:14:09.0766667+00:00
Avanish Tomar 0 Reputation points
answered 2024-11-19T02:08:27.0933333+00:00
LiHongMSFT-4306 28,576 Reputation points
2 answers One of the answers was accepted by the question author.

Bulk Insert not working in SQL Server 2016

Hi, I am trying to insert the following CREATE TABLE Palletinfo ( id int IDENTITY(1,1) PRIMARY KEY, Parcel_Id varchar(20), Pallet_Id varchar(10), Date_Upload datetime, ); ID,Parcel ID,Pallet_ID,Date_Upload …

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2021-02-10T11:12:13.057+00:00
Christopher Jack 1,616 Reputation points
commented 2024-11-18T16:05:11.91+00:00
Hans Haupt 0 Reputation points
1 answer One of the answers was accepted by the question author.

find duplicate record

Hi, have 3 rows in one table how to remove 2 duplicate from table 1, 2, 3 1, 2, 3 1, 2, 3

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,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-11-16T08:40:28.9666667+00:00
Vineet S 1,230 Reputation points
accepted 2024-11-16T14:44:23.7366667+00:00
Vineet S 1,230 Reputation points
2 answers One of the answers was accepted by the question author.

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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-11-08T10:01:41.47+00:00
SSinhg 316 Reputation points
commented 2024-11-14T23:47:38.15+00:00
SSinhg 316 Reputation points
5 answers

SSIS not inserting all rows from ODBC (oracle) to SQL server 2019

I have an issue with migration to SQL server 2019. My Source is Oracle and my Destination is Microsoft SQL Server 2019. My package consists of a simple Data Load task; ODBC Source Connection(oracle)/ and OLE DB Destination connection(2019 SQL…

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,061 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,600 questions
SQL Server Migration Assistant
SQL Server Migration Assistant
A Microsoft tool designed to automate database migration to SQL Server from Access, DB2, MySQL, Oracle, and SAP ASE.
540 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2021-04-05T06:10:44.777+00:00
Kumar, A. be 16 Reputation points
commented 2024-11-14T06:34:08.11+00:00
Maxwell Hartono 0 Reputation points
4 answers

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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-11-07T18:28:16.3166667+00:00
Julia9534 16 Reputation points
commented 2024-11-13T16:48:11.5333333+00:00
Bruce (SqlWork.com) 67,176 Reputation points
2 answers One of the answers was accepted by the question author.

TSQL month name to date

Hi, I have a table with a MNTH column that contains month prefixes - 'JUL', 'AUG', 'SEP', 'OCT', etc., up to 'JUN' of next year. My financial year for this data starts in July and ends in June. Thus, in this data set - start from 202407 up to 202506. In…

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,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-11-11T16:52:47.7066667+00:00
Zimiso 141 Reputation points
edited the question 2024-11-12T01:00:29.89+00:00
LiHongMSFT-4306 28,576 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.
14,061 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,944 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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,991 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.
14,061 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,661 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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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,576 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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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.
14,061 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,944 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,600 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,292 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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,991 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.
14,061 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,600 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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,576 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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 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,576 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.
14,061 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,661 questions
asked 2024-10-26T06:49:00.1066667+00:00
Vineet S 1,230 Reputation points
commented 2024-10-30T07:26:06.03+00:00
NIKHILA NETHIKUNTA 3,505 Reputation points Microsoft Vendor