4,574 questions with Transact-SQL-related tags

Sort by: Updated
0 answers

Unexpected truncation error when inserting from UTF8 to non-UTF8 collation

I believe I am hitting a bug with moving data from a UTF8 to a non-UTF8 collations in SQL Server 2022 CU13 (running under Linux but assuming for now this issue is not related). The issue is that MSSQL appears to be determining the width of a string for…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-11T00:42:42.9533333+00:00
Ben 0 Reputation points
commented 2024-06-11T14:44:02.1333333+00:00
Ben 0 Reputation points
1 answer

Get Global Primary details from All the replicas in Distributed AlwaysOn

In Distributed AlwaysOn, I could not find any DMVs in SQL Server which could provide the details about Global Primary from replicas in Forwarder side (both Primary Forwarder and its local replicas). Is there a way to at-least pull the Global Primary…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-10T14:06:34.08+00:00
Sajal Bagchi 0 Reputation points
commented 2024-06-11T13:31:55.5666667+00:00
Sajal Bagchi 0 Reputation points
2 answers

WHY Index Scan Instead Of Seek While Joining Big Table With #Temp Table

In my sql server 2016 database, I have a table 'BigData' having around 50 million rows and a Temporary table #TempID which contains 600 rows. CREATE TABLE BigData (ID INT IDENTITY(1,1) PRIMARY KEY, OtherID INT, Comment nvarchar(max),…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-10T11:46:44.9033333+00:00
Vikrant Sirohi 0 Reputation points
edited a comment 2024-06-11T03:45:37.8833333+00:00
Vikrant Sirohi 0 Reputation points
2 answers

transpose row data into columns

Hope I'm asking this correctly. I have a table in this format: I need to have the Unique ID and the account numbers from both stores all in the same record. Like this: How can I accomplish this in SQL? Is this some kind of PIVOT or UNPIVOT? What…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-08T14:01:19.5733333+00:00
Dom 751 Reputation points
answered 2024-06-11T02:41:48.63+00:00
CosmogHong-MSFT 24,186 Reputation points Microsoft Vendor
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.
4,744 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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2023-12-19T13:11:52.4966667+00:00
Kıvanç ÖZDEMİR 125 Reputation points
commented 2024-06-09T14:12:46.3466667+00:00
Yitzhak Khabinsky 25,291 Reputation points
1 answer

Syntax Error When Attempting to run PREDICT function against table in dedicated pool in Synapse Studio

I am attempting to complete the tutorial listed here : https://learn.microsoft.com/en-us/azure/synapse-analytics/machine-learning/tutorial-sql-pool-model-scoring-wizard I am able to complete all of steps until I get to the final step, where I use Synapse…

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,533 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-05T22:27:20.54+00:00
Andy 0 Reputation points Microsoft Employee
answered 2024-06-06T10:41:02.9033333+00:00
phemanth 7,190 Reputation points Microsoft Vendor
2 answers One of the answers was accepted by the question author.

Unable to Uninstall SQL Server 2019

I'm trying to uninstall SQL Server 2019 (64-bit) from the Control Panel, but I'm encountering errors during the uninstallation process. I was able to remove all the features, but I received a prompt to restart my system. After restarting, I noticed that…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-03T11:48:17.8633333+00:00
Pramod Kumar 20 Reputation points
edited the question 2024-06-06T06:11:01.7766667+00:00
Rakesh Gurram 4,320 Reputation points Microsoft Vendor
2 answers

How to fix Duplicate Output in sql server when using Distinct Create performance Issue

Respected Techie, I am facing very Bizarre issue of Duplicate Record in sql Output. May someone please help me with their expertise. I am very much Thankful for your kind help. The Problem I am facing is I am brining column from multiple dimension table…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-04T05:12:32.3666667+00:00
Uma 426 Reputation points
answered 2024-06-04T21:29:45.8733333+00:00
Erland Sommarskog 102.9K Reputation points
1 answer One of the answers was accepted by the question author.

select top results without selecting columns

select top results without selecting columns?

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-06-04T15:25:35.46+00:00
Jonathan Brotto 140 Reputation points
accepted 2024-06-04T17:59:56.2133333+00:00
Jonathan Brotto 140 Reputation points
3 answers

i have few snapshot transactions, now i need to put nolock/read uncommit for perticular table

hi, I have few snapshot transactions , now my admin has informed me that put no lock in all tables in snapshot transactions, as it was blocking locking deadlocking with others. so I suggested to put read uncommited instead of snapshot when u are…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-20T07:11:58.9+00:00
Rajesh Kumar Yadav 0 Reputation points
commented 2024-05-31T20:47:35.6666667+00:00
Erland Sommarskog 102.9K Reputation points
2 answers One of the answers was accepted by the question author.

Benefits and disadvantages of WITH (NOLOCK)

Benefits and disadvantages of WITH (NOLOCK). Also is there other commands that can serve different use cases.

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-30T15:12:46.18+00:00
Jonathan Brotto 140 Reputation points
answered 2024-05-30T21:20:01.3066667+00:00
Erland Sommarskog 102.9K Reputation points
1 answer

delimited split gives null for some items

hi all, I am using a function to split a string into multiple rows. The function is available here: https://www.sqlservercentral.com/articles/tally-oh-an-improved-sql-8k-%e2%80%9ccsv-splitter%e2%80%9d-function What I am trying to figure out is how 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,029 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.
54 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-29T13:43:14.27+00:00
elsvieta 346 Reputation points
commented 2024-05-29T15:01:51.0966667+00:00
elsvieta 346 Reputation points
2 answers One of the answers was accepted by the question author.

bit null ,0

Hey Team, have column1 datatype (bit,null) so it only takes values like 0 and 1 but i want true , false as well...how to get that in same datatype or in different one

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-27T16:52:36.8833333+00:00
Vineet S 205 Reputation points
accepted 2024-05-28T09:36:31.5433333+00:00
Vineet S 205 Reputation points
4 answers

Conversion failed when converting the varchar value to data type int in a JOIN

So we have a SQL Server Stored Procedure that has a JOIN using a data column that is defined in the "To Be" Joined Table as INT. The data column in our joining criteria is defined as a data type NVARCHAR(100). So the SQL Server Stored Procedure…

Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2020-08-29T13:45:37.25+00:00
Bobby P 221 Reputation points
answered 2024-05-28T08:57:41.9733333+00:00
Tamer Al-Debsi 0 Reputation points
1 answer

SSMS not flagging basic errors after IIF statement

DMF_SSMS_SQL_IIF_Err.pdf I just wanted to notify Microsoft of an error I believe I found with SSMS error notification. Going thru some scripts, I came across one that had a CASE and IIF in it. I accidently did a typo, no errors, but failed. I then…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-20T15:07:50.28+00:00
AdamG Devl 0 Reputation points
commented 2024-05-24T16:02:35.9133333+00:00
AdamG Devl 0 Reputation points
0 answers

Trying to Bulk Insert SSN data into an always Encrypted column and is not working. Any guidance please.

I am having trouble Bulk inserting the SSN data from a simple SQL table to a table where I have an always encrypted column. I am not getting any right solution after googling around. Please share if anyone has done similar kind of work. Thanks, SK.

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-22T18:37:24.0333333+00:00
Sanjay Kumar 0 Reputation points
commented 2024-05-23T06:00:27.9133333+00:00
CosmogHong-MSFT 24,186 Reputation points Microsoft Vendor
2 answers One of the answers was accepted by the question author.

Querying with Filename and Filepath Functions in Synapse Serverless

Hello, I have been reading about using filename() and filepath() in t-sql statements with synapse serverless sql: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/query-specific-files#functions Wondering if for the following statement:…

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,533 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-21T17:38:30.0266667+00:00
Karl Gardner 85 Reputation points
answered 2024-05-21T20:52:17.8666667+00:00
Karl Gardner 85 Reputation points
2 answers One of the answers was accepted by the question author.

Can't figure out why The select list for the INSERT statement contains fewer items than the insert list

Hi everyone, I want to create a stored procedure that will create a table and return value, but I got this message: Msg 120, Level 15, State 1, Procedure sp_Month01_FYCalendar, Line 36 [Batch Start Line 9] The select list for the INSERT…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2022-11-11T22:32:34.147+00:00
Claude Larocque 666 Reputation points
commented 2024-05-20T12:38:59.0466667+00:00
Paul Yardley 0 Reputation points
2 answers One of the answers was accepted by the question author.

SQL Server - Question marks inserted with Hebrew collation

SQL Server 2019, Developer edition, Windows 10. The client is SSMS 18. When database is created with Hebrew collation, for example, Hebrew_CI_AI, there is no problem, Hebrew strings are inserted and being read as they are. When database is created…

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,029 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2021-06-22T16:29:10.737+00:00
Natalie Sh 26 Reputation points
commented 2024-05-19T08:01:18.8333333+00:00
Erland Sommarskog 102.9K Reputation points
1 answer One of the answers was accepted by the question author.

Exception problem

Hi, I've got issue due to this line below. reader = cmd.ExecuteReader(); Can it be owing to no record returned?

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,029 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,457 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,574 questions
asked 2024-05-10T08:22:21.91+00:00
Peter_1985 2,586 Reputation points
accepted 2024-05-16T09:48:36.94+00:00
Peter_1985 2,586 Reputation points