4,600 questions with Transact-SQL-related tags

Sort by: Updated
2 answers

The transaction log for database is full due to 'REPLICATION'

Hi! I have a SQL 2019 database that is a member of 3 node always on availability group. It is also the subscriber being populated from a DB2 database. The log keeps filling up and I am unable to shrink or backup.. I get the message: The transaction log…

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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2022-04-25T08:33:47.077+00:00
zoe Ohara 286 Reputation points
commented 2024-05-07T09:12:45.76+00:00
Rishi Sethi 0 Reputation points
2 answers

Data output error using specific scenario in SQL Join

Going though something very strange while running the SQL Query. External Table: dl.tableA has a varchar value "EmployeeSequenceNumber" in column EmployeeSequenceNumber , while doing the inner join with dim.tableB, the query is getting…

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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-05-05T14:26:32.57+00:00
NIKHIL KUMAR 101 Reputation points
commented 2024-05-06T02:30:15.07+00:00
LiHongMSFT-4306 25,651 Reputation points
5 answers

Windows 11 SQL Server install error Wait on the Database Engine Recovery Handle Failed

In Windows 11 Machine, unable to install SQL server 2019. I tried multiple versions. but got the following error message. I tried multiple times and restart the machine. nothing worked out. Please somebody help with this. Edition Windows 11…

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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2022-12-27T14:14:32.197+00:00
S Dineshkumar 1 Reputation point
answered 2024-05-04T17:42:37.73+00:00
Alok Jha 0 Reputation points
2 answers One of the answers was accepted by the question author.

Unable to add a index hint to a simple query

I have a table with milions of records CREATE TABLE documents ( id bigint primary key, external_system nvarchar(50), external_docid nvarchar(50)) and non clustered filtered unique index CREATE UNIQUE INDEX documents_ix19 ON…

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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-05-02T07:44:45.3166667+00:00
Jan Vávra 256 Reputation points
commented 2024-05-03T20:56:33.33+00:00
Erland Sommarskog 107K Reputation points
1 answer

sql query where with condition

Hi, I have a query same but only one of the where clauses differ. If (@accountID = 100) Begin select field1, field2 FROM table1 left outer join table 2 where status = 'x' and ISNULL(accountid, @accountID) = @accountID END Else select field1,…

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,347 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.
67 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-05-02T22:32:38.0266667+00:00
Spunny 326 Reputation points
edited the question 2024-05-03T01:35:39.6133333+00:00
LiHongMSFT-4306 25,651 Reputation points
7 answers

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. 'Document' (RDOC)

how to identify the field that brings more than one value? when I run the store procedure I don't see the 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.
13,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2022-02-16T02:07:29.47+00:00
Yefer Bastidas 1 Reputation point
commented 2024-04-29T09:24:03.0466667+00:00
Turan Kilic 5 Reputation points
3 answers

SQL Server - Print Child SP Error Message

I am executing a system store Proc inside a user defined stored proc, I would like help to store the error message returned by the system sp and print it from the parent sp. Below is the code of the system stored proc which is being executed from parent…

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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2022-02-22T23:41:32.867+00:00
Rahul Polaboina 181 Reputation points
answered 2024-04-29T08:13:08.6933333+00:00
Mark 0 Reputation points
7 answers One of the answers was accepted by the question author.

"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

Hello All, i am trying to connect to sql server database using ODBC connection string. i am fine when i access application with local sql server. but problem is when connecting to another standalone sql server. the error i am getting 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.
13,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2021-01-12T17:49:24.317+00:00
Raki 481 Reputation points
commented 2024-04-26T02:00:02.24+00:00
Justin Vu 0 Reputation points
3 answers

Item order in Correct Format

here is my query and query result also i pest what result what i want SELECT StockGroup [Stock Group], [Item Description], [Balance Bag] [In Stock], [UOM 1], [Balance Stock] [In Stock], [UOM 2], [Usage Per Day], [No of Days In Stock], [Lead 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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-22T08:34:08.9866667+00:00
Hiteshkumar Patel 0 Reputation points
answered 2024-04-25T18:26:49.8366667+00:00
Bruce (SqlWork.com) 61,491 Reputation points
4 answers

SQL Server optional parameter performance issue

Hello guys, I have an optional parameter in a SP e.g. @MyParam int = NULL When I check the param against NULL upfront I end up with TWO queries e.g. IF (@MyParam IS NULL) BEGIN SELECT ... END ELSE BEGIN SELECT ... END Otherwise if I check…

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,347 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.
67 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-05T12:56:45.11+00:00
Kuler Master 266 Reputation points
commented 2024-04-23T06:19:14.9066667+00:00
LiHongMSFT-4306 25,651 Reputation points
3 answers One of the answers was accepted by the question author.

Is support for SQL data queries in Excel being phased out?

I was told today by my IT department that I'll have to stop using Excel with SQL data queries to pull data directly into Excel from a SQL server. They stated that Microsoft was phasing out this feature. I couldn't find anything searching the Microsoft…

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,687 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,875 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-19T19:34:52.87+00:00
Colin Sachs 40 Reputation points
answered 2024-04-22T15:44:42.1933333+00:00
Colin Sachs 40 Reputation points
2 answers One of the answers was accepted by the question author.

best approach to migrating a table from system to another

I have a test system where we update entries on a table for cross refence purpose and was wondering the best approach for 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.
13,347 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.
517 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.
67 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-19T19:52:02.5533333+00:00
Jonathan Brotto 220 Reputation points
accepted 2024-04-22T13:09:20.73+00:00
Jonathan Brotto 220 Reputation points
1 answer One of the answers was accepted by the question author.

Best way to learn SSIS

I got a new role where we will use SSIS to migrate data from test system to production. What would be the best way to learn SSIS as I have worked with T-SQL and SSMS. It will be on premise 2019 edition.

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,347 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,525 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.
517 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,263 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-19T19:35:40.58+00:00
Jonathan Brotto 220 Reputation points
accepted 2024-04-19T20:54:43.45+00:00
Jonathan Brotto 220 Reputation points
3 answers

The characters of a database's table's volumn_name is replaced by question marks, how to fix it ?

Hi everyone, my database have a table which volumn_names are Chinese characters. when I use " SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'table-name '; " the volumn_name display correctly, but if I use " select…

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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-18T07:29:57.3566667+00:00
Tina Yi 0 Reputation points
answered 2024-04-19T03:20:17.23+00:00
LiHongMSFT-4306 25,651 Reputation points
1 answer One of the answers was accepted by the question author.

VB.NET SQL Connection and SQL Command Error BC3002

Hello, I'm in the process of converting VBA to VB.NET with SQL statements. One of the changes is utilizing the "ExecuteNonQuery". Since I'm still learning the syntax, I simply copied the VB.NET statements from a web-site. But I'm getting 2…

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,665 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.
67 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-16T16:02:09.4533333+00:00
Giacomo Raucci 321 Reputation points
commented 2024-04-19T00:41:22.3566667+00:00
Giacomo Raucci 321 Reputation points
1 answer

should i prefer join over exists or in

hi, I have seen people use exists when exists is required and no cols are required in select. But I notice sometimes exists slows down and join performs better q1) is there any news i should know ,  that one should not use exists or in , and should go…

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,347 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,875 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.
67 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-16T07:20:37.7866667+00:00
Rajesh Kumar Yadav 20 Reputation points
answered 2024-04-18T00:59:52.34+00:00
Greg Low 1,685 Reputation points Microsoft Regional Director
0 answers

Synapse Serverless CETAS fails with error "Fatal exception occurred: bad allocation".

Hello, I am trying to create an external table (CETAS) from a large amount of fairly small json files, so that they can be queried more efficiently. The json files are stored on ADLS. Previously this worked fine, when i let the query run for 1 - 1.5…

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,426 questions
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,687 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-08T15:27:45.2433333+00:00
Finn Schmidt 46 Reputation points
commented 2024-04-16T07:43:20.5333333+00:00
PRADEEPCHEEKATLA-MSFT 85,511 Reputation points Microsoft Employee
2 answers

Connect to on-prem sql server using Azure Relay

Hi, I would like to connect to a on-prem sql server and execute T-SQL commands to listen and receive SQL broker messages from Azure cloud hosted .net application. How can i connect to on-prem sql server and execute these sql commands and receive the…

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,643 questions
Azure Fluid Relay
Azure Fluid Relay
An Azure service used to add real-time collaborative experiences to apps with Fluid Framework.
2 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.
67 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-01T07:44:00.09+00:00
Santhi Dhanuskodi 205 Reputation points
edited the question 2024-04-15T16:10:13.3+00:00
MayankBargali-MSFT 70,011 Reputation points
2 answers

Delete query throws "semaphore timeout period has expired"

Hi All, I'm running a delete query as part of purge activity. The delete query has about 12+ foreign key constraints, and when we try to delete 1300 records as per our condition we get the below error. The table has about only 15K records and the db…

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,347 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-09T17:56:57.0133333+00:00
Arunkumar Janakiraman 1 Reputation point
answered 2024-04-12T05:04:08.69+00:00
ShaktiSingh-MSFT 14,406 Reputation points Microsoft Employee
1 answer

Complex Pivot using the existing data

--ALTER PROCEDURE Energy.GetGTSTDataForManualEntry --( -- @Date DateTime -- ) --AS BEGIN DECLARE @Date DateTime = '2024-03-29 00:00:00.000'; DECLARE @CalendarID INT = Time.GetCalendarIDByLocationCode('Energy'); DECLARE @DayPeriod…

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,347 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.
67 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,600 questions
asked 2024-04-07T09:23:56.2033333+00:00
pepcoder 1 Reputation point
edited a comment 2024-04-11T05:13:40.8+00:00
pepcoder 1 Reputation point