69 questions with SQL Server Transact-SQL tags

Sort by: Updated
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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,601 questions
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 25,651 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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
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 107.1K Reputation points
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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
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 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.
69 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,601 questions
asked 2024-02-01T13:47:50.79+00:00
Peter Bishop 161 Reputation points
answered 2024-02-01T14:06:39.1+00:00
Peter Bishop 161 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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,601 questions
asked 2024-01-22T10:36:27.7466667+00:00
Indiana 0 Reputation points
commented 2024-01-29T02:09:26.5666667+00:00
LiHongMSFT-4306 25,651 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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,601 questions
asked 2024-01-22T13:07:05.89+00:00
Arutprakasam 261 Reputation points
answered 2024-01-22T22:29:53.3633333+00:00
Konstantinos Passadis 17,456 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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
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 35,556 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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
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
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 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.
69 questions
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 35,556 Reputation points