200 questions with SQL Server | SQL Server Transact-SQL tags

Sort by: Updated
3 answers

Cannot connect to SQL Management studio 19.3

Hi Microsoft team, I have been trying to connect to the SQL server for a long time now and i have been getting error message cannot connect to.... How can i overcome this challenge?

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.
3,063 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,703 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,344 questions
SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-02-08T16:10:07.1266667+00:00
Boluwaji Olusegun 5 Reputation points
commented 2024-02-29T05:56:26.4866667+00:00
LiHongMSFT-4306 31,571 Reputation points
1 answer One of the answers was accepted by the question author.

Subquery makes complet code very slow

Hello, I have the following query that uses another query. As I understand the runtime behavior, this second query is called again every time the main query creates a new record. Both queries are actually quite fast. Unfortunately, the overall construct…

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-02-24T16:15:05.8866667+00:00
Hans Furmann 40 Reputation points
commented 2024-02-25T14:11:43.1966667+00:00
Erland Sommarskog 121.9K Reputation points MVP Volunteer Moderator
1 answer

SQL Server unit test Item - Unable to locate version 17.10

Hi, I have installed Visual Code v 17.10 to start Unit testing but I'm unable to locate new item called Unit Test, Any thoughts where to locate or install to see SQL Server Unit Test item?

SQL Server | SQL Server Transact-SQL
asked 2024-02-23T05:53:46.3933333+00:00
Imdaad Khan 0 Reputation points
answered 2024-02-23T06:28:38.12+00:00
Olaf Helper 47,441 Reputation points
3 answers

Best Practice/Standard Alias Schema/Table Convention

Just looking for suggestions for best practices and/or standards for table aliases in a Query. I know this is very subjective...but just looking for some general guidelines from experts and their experience and what works and what might not work. Should…

SQL Server | SQL Server Transact-SQL
Developer technologies | Transact-SQL
asked 2024-02-21T15:20:45.85+00:00
Bobby P 231 Reputation points
answered 2024-02-22T00:47:33.9466667+00:00
Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
2 answers

select query where condition with in operator and string with %

Hi, Below query is not working with in operator and string having % sign. DECLARE @types Table ( ID int, type varchar(50) mailtype varchar(50) ) INSERT INTO @types (ID, type, mailtype) SELECT 1, 'Redem', 'ABS_HOME' UNION SELECT 2,…

SQL Server | SQL Server Transact-SQL
asked 2024-02-20T16:53:10.2966667+00:00
Spunny 366 Reputation points
edited the question 2024-02-20T22:31:27.2133333+00:00
Erland Sommarskog 121.9K Reputation points MVP Volunteer Moderator
1 answer One of the answers was accepted by the question author.

Grouping Data

Hello there, I need a help about the SQL Query. Data example: Date Amount 2024-01-11 10:15 1000 2024-01-11 11:10 2000 2024-01-12 10:16 5000 2024-01-13 11:12 4000 2024-01-13 11:18 4000 Expeceted result: Date Amount…

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.
3,063 questions
SQL Server | SQL Server Transact-SQL
Developer technologies | Transact-SQL
SQL Server | Other
asked 2024-02-14T09:10:13.5133333+00:00
Kuler Master 406 Reputation points
accepted 2024-02-14T21:06:02.1566667+00:00
Kuler Master 406 Reputation points
2 answers

Azure SQL Database Stored Procedure long execution time issue

In my Azure SQL Database I have Stored Procedure sp_subledger (Attached the code : sp_subledger.txt) The Stored Procedure is completing within 1 min when Tenant = 1 is provided but when Tenant = 2 is provided it is running for more than 2 hours. for…

Azure SQL Database
SQL Server | SQL Server Transact-SQL
Developer technologies | Transact-SQL
asked 2024-02-07T16:10:08.8533333+00:00
Arundhati Sen 151 Reputation points
commented 2024-02-13T22:15:14.64+00:00
Saurabh Sharma 23,851 Reputation points Microsoft Employee Moderator
2 answers One of the answers was accepted by the question author.

language of sql server 2022 and SSMS

Hello, I installed sql server 2022 and ssms in English on my machine. how to change the language to French of my sql server 2022 and my ssms. Best Regards

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-02-09T12:23:46.3266667+00:00
YETIANRI EMMANUEL OUSMANE SORI 246 Reputation points
accepted 2024-02-13T07:17:31.0966667+00:00
YETIANRI EMMANUEL OUSMANE SORI 246 Reputation points
1 answer One of the answers was accepted by the question author.

Where to graph precise tsql for a query run from php

I'd like to pin a plan for a query by adding a table hint. I've read the docs that says the query text pasted into @stmt must be the same as came from the app. I used the Extended Events 'sql_statement_completed' and 'rpc_completed' to get precise sql…

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-02-09T21:33:40.59+00:00
Jan Vávra 386 Reputation points
commented 2024-02-09T22:35:46.38+00:00
Erland Sommarskog 121.9K Reputation points MVP Volunteer Moderator
1 answer

sql select query

Hi, We get data from vendor and import into table like this TxID BCode Ecode SType SCode Desc 12345 SR SR MF Abc This is one type 12346 SD SD MF Bcd One more type 12347 CC SD OF Efg New type 12348 SR SR MF Xyz I get…

SQL Server | SQL Server Transact-SQL
asked 2024-02-06T15:03:38.7633333+00:00
Spunny 366 Reputation points
edited a comment 2024-02-09T06:30:03.11+00:00
Viorel 122.6K Reputation points
1 answer

The underlying provider failed on Open. while connecting to SQL Azure database through mvc application login

I've deployed my MVC application successfully on Azure..But while logging into application I get "The underlying provider failed on Open." I've implemented transient failure in code also. I connected my application locally to Azure SQL DB, its…

Azure SQL Database
SQL Server | SQL Server Transact-SQL
asked 2024-01-17T08:55:29.19+00:00
Dhananjay 0 Reputation points
answered 2024-02-06T04:19:28.3833333+00:00
hossein jalilian 11,055 Reputation points Volunteer Moderator
1 answer

How to calculate number of weeks worked by an employee for a fiscal year in sql server

How to determine the total weeks an employee has worked during a fiscal year using SQL Server. My start date is 12-28-2023 and till today, I would like to calculate the no.of weeks worked by an employee during that time.

SQL Server | SQL Server Transact-SQL
Developer technologies | Transact-SQL
SQL Server | Other
asked 2024-02-02T20:23:26.1633333+00:00
Maddi, Shyam 0 Reputation points
commented 2024-02-05T03:32:24.3566667+00:00
LiHongMSFT-4306 31,571 Reputation points
1 answer

How can I close this Configuration review point 'Sanitize Database and Application User Input '

How we can close this configuration review point on Sanitize Database and Application User Input can you please guide me to close

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-02-02T05:07:46.3066667+00:00
Srinivas Syamala 20 Reputation points
answered 2024-02-02T22:13:58.26+00:00
Erland Sommarskog 121.9K Reputation points MVP Volunteer Moderator
1 answer One of the answers was accepted by the question author.

From which version did SQL Server start showing the actual duplicate value in primary key violations

Dear Experts, Could you please let me know from which version did SQL Server start showing the actual duplicate values in primary key violations. Take for example, in some older versions, I only see something like this. "Violation of PRIMARY KEY…

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-02-01T13:14:54.7066667+00:00
mo boy 396 Reputation points
accepted 2024-02-02T00:00:15.31+00:00
mo boy 396 Reputation points
1 answer

T-SQL R language - return fewer columns

I'm running an R language script under T-SQL where I use REGEX to validate data in two columns. However I only want to output the id column in my result set. My script is: EXECUTE sp_execute_external_script @language = N'R', @script = N' pattern =…

SQL Server | SQL Server Transact-SQL
Developer technologies | Transact-SQL
asked 2024-02-01T13:47:50.79+00:00
Peter Bishop 181 Reputation points
answered 2024-02-01T14:06:39.1+00:00
Peter Bishop 181 Reputation points
1 answer

sqlpackage export data

Is it possible to export data only of all the tables in the DB using sqlpackage export action? Schema is not to be included in the .bacpac file.

SQL Server | SQL Server Transact-SQL
Developer technologies | Transact-SQL
SQL Server | Other
asked 2024-01-22T10:36:27.7466667+00:00
Indiana 0 Reputation points
commented 2024-01-29T02:09:26.5666667+00:00
LiHongMSFT-4306 31,571 Reputation points
2 answers

How to do the bulk insert of one lack records in sql server using node js

Hi, I will store the data in following Json format. Now I want to insert this one lack. records in sql server. Kindly Please provide the best solution and if it's possible share your solution with sql query. [ { key: value, key: value, key: value, key:…

Azure SQL Database
SQL Server | SQL Server Transact-SQL
Developer technologies | Transact-SQL
SQL Server | Other
asked 2024-01-22T13:07:05.89+00:00
Arutprakasam 261 Reputation points
answered 2024-01-22T22:29:53.3633333+00:00
Konstantinos Passadis 19,591 Reputation points MVP
4 answers

Tempdb Shrink Issue in SQL Server

Dear Support Team, I need your consultancy regarding this issue: After shrinking the tempdb in Microsoft sql management studio the tempdb does not shrink and the disk size is not reclaimed even though the db is not being used only works after a restart…

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-01-18T11:09:46.98+00:00
Jad Tabet 0 Reputation points
edited an answer 2024-01-19T07:30:51.8133333+00:00
ZoeHui-MSFT 41,491 Reputation points
2 answers One of the answers was accepted by the question author.

Could Cross Apply be used in this query?

Here is a demo of my actual table: create table #demo (ID int, ItemID int, QTY int) insert into #demo values (1,101,3),(2,102,1),(3,101,4),(4,102,2),(5,103,3) I have written a query: SELECT t2.ID,t2.QTY,t2.ItemID,t1.TotalQTY FROM (SELECT ItemId,SUM(QTY)…

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-01-19T02:31:13.2633333+00:00
Y.N 80 Reputation points
accepted 2024-01-19T06:05:00.81+00:00
Y.N 80 Reputation points
2 answers

SQL server 2022

Hi I just installed SQL 2022 Enterprise with trial Now I want to install SQl 2022 standard edition, so Can I backup SQL 2022 Enterprise server DB back up and Restore it to SQL 2022 Standard edition?

SQL Server | SQL Server Transact-SQL
SQL Server | Other
asked 2024-01-17T06:19:50.73+00:00
lushantha harshapriya 0 Reputation points
edited an answer 2024-01-18T05:20:25.6466667+00:00
ZoeHui-MSFT 41,491 Reputation points