4,577 questions with Transact-SQL-related tags

Sort by: Updated
1 answer

Querying table index stats not working

I am trying to query my tables index fragmentation in Azure Synapse studio with query: SELECT IPS.Index_type_desc, IPS.avg_fragmentation_in_percent, IPS.avg_fragment_size_in_pages, IPS.avg_page_space_used_in_percent, …

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,553 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,068 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,892 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-06-14T09:17:01.14+00:00
Jani Hämäläinen 20 Reputation points
answered 2024-06-14T21:25:10.3566667+00:00
Erland Sommarskog 103.5K Reputation points MVP
3 answers One of the answers was accepted by the question author.

Partition by filter

Hey Team I have table where A values comes then E value should be filter or else E value should be there partition by data and mpr column expected values

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,068 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.
57 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-06-14T14:34:28.8633333+00:00
Vineet S 205 Reputation points
edited an answer 2024-06-14T21:11:05.9233333+00:00
Naomi Nosonovsky 405 Reputation points
2 answers One of the answers was accepted by the question author.

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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-06-11T00:42:42.9533333+00:00
Ben 20 Reputation points
commented 2024-06-14T19:59:37.46+00:00
Ben 20 Reputation points
2 answers

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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-06-10T14:06:34.08+00:00
Sajal Bagchi 5 Reputation points
answered 2024-06-14T10:12:31.99+00:00
Ali Varzeshi 0 Reputation points
2 answers One of the answers was accepted by the question author.

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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-06-08T14:01:19.5733333+00:00
Dom 771 Reputation points
commented 2024-06-13T16:44:02.6533333+00:00
Dom 771 Reputation points
2 answers

unable to convert unique identifier

Hi Team, unable to convert this value as an unique identifier and getting null values SELECT try_convert(uniqueidentifier,''9UIC32D1-932-4V03-45E9-FGSGDASASDATY'')testid

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,068 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,486 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,256 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-06-12T07:17:37.1633333+00:00
Vineet S 205 Reputation points
commented 2024-06-13T08:27:50.7633333+00:00
Erland Sommarskog 103.5K Reputation points MVP
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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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
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,763 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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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,376 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,553 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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,345 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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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,560 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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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 103.5K Reputation points MVP
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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-06-04T15:25:35.46+00:00
Jonathan Brotto 160 Reputation points
accepted 2024-06-04T17:59:56.2133333+00:00
Jonathan Brotto 160 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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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 103.5K Reputation points MVP
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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-05-30T15:12:46.18+00:00
Jonathan Brotto 160 Reputation points
answered 2024-05-30T21:20:01.3066667+00:00
Erland Sommarskog 103.5K Reputation points MVP
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,068 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.
57 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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,577 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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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,068 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 questions
asked 2024-05-22T18:37:24.0333333+00:00
Sanjay Kumar 0 Reputation points
commented 2024-05-23T06:00:27.9133333+00:00
LiHongMSFT-4306 24,361 Reputation points
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,553 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,577 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