4,600 questions with Transact-SQL-related tags

Sort by: Updated
3 answers

IN SSIS How to change SQL Authentication to Windows Authentication

HI I was trying to deploy the packages in to server it is erroring out with the below error . TITLE: SQL Server Integration Services The operation cannot be started by an account that uses SQL Server Authentication. Start the operation with an account…

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,353 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
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-05-24T17:50:21.357+00:00
Dinesh Shetty 1 Reputation point
answered 2024-02-14T07:09:31.4833333+00:00
Krishna Shah 5 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 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-02-07T16:10:08.8533333+00:00
Arundhati Sen 151 Reputation points
commented 2024-02-13T22:15:14.64+00:00
Saurabh Sharma 23,791 Reputation points Microsoft Employee
4 answers One of the answers was accepted by the question author.

Joing two tables in SQL with Different Primary Keys

Hi, I'm trying to join two tables, they are both string datatype but the only difference is the first table having an extension number either '001', '002', or '003', etc. I was thinking to use LIKE % but I'm not sure how. I have like thousands of…

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,353 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-09-21T07:47:34.377+00:00
Sherlan Emmanuel Burgonia 86 Reputation points
edited an answer 2024-02-13T01:59:39.7166667+00:00
Sherlan Emmanuel Burgonia 86 Reputation points
2 answers

How to handle blank space in table

Hi Expert, How to enter blank space and default date in timestamp column create table tabletest1 (col1 char(23), col2 int,col3 decimal(3,3),col4 timestamp) 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,353 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-02-11T04:14:48.8966667+00:00
Shambhu Rai 1,411 Reputation points
commented 2024-02-13T00:41:38.2366667+00:00
Shambhu Rai 1,411 Reputation points
1 answer One of the answers was accepted by the question author.

Updating running balance in SQL

How can I update the Balance in a SQL table based on the BillAmount , EmployeeId and Id fields? I want to update the balance of every record to be less by the BillAmount of that record when compared to the immediate previous record for the same…

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-02-08T15:35:07.85+00:00
Michael M.M. D'Angelo 176 Reputation points
commented 2024-02-09T23:03:50.6733333+00:00
Erland Sommarskog 107.1K Reputation points
1 answer

TSQL Lag Calculate the Period Delta from a column which has only Period Ending Balances

We are trying to derive the period change amount from a table which only has period ending values. This is sample code: --We are trying to derive the period change amount from a table which only has period ending values. --This is sample…

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,353 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-02-07T15:24:12.07+00:00
vsslasd 556 Reputation points
answered 2024-02-09T21:13:34.8233333+00:00
vsslasd 556 Reputation points
5 answers

double qoutes issue

Hi Expert, I want to remove the double qoutes from end and start of the statement create table table1 ( col1 varchar(200)) create table table1 ( col1 varchar(200)) insert into tale1 values('"Test1 Test1 Test1 "Test1"…

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,353 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,878 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-01-24T13:08:48.6533333+00:00
Shambhu Rai 1,411 Reputation points
edited an answer 2024-02-06T20:12:12.96+00:00
Adam 21 Reputation points
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,353 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-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

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.
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-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,353 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-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
1 answer

How to get dynamic variable in 'Delete Activity' in Azure Synapse.

I am new to azure synapse analytics. I want to delete a folder from a container having format 'YYYYMMM' if it exists. If folder is not there ,a new folder same format YYYYMMM should be created. I have tried as below but could not be able to delete the…

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,692 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-01-25T07:56:43.46+00:00
Sebika Pradhan 0 Reputation points
answered 2024-01-28T12:10:00.6266667+00:00
Amira Bedhiafi 20,101 Reputation points
1 answer

Create a Table based on Multiple Criteria

Hello All, I am a Power BI developer and I have come across a problem that I need help solving. I want to create a table based on multiple criteria. I am doing a drill through from one page to another, where I can see the details of feedback 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,353 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-01-24T15:26:31.5366667+00:00
Sana Shaikh 0 Reputation points
edited the question 2024-01-26T01:36:00.6666667+00:00
LiHongMSFT-4306 25,651 Reputation points
3 answers One of the answers was accepted by the question author.

How to get data related from #parts table based on company id and in case of table #company not have companyid then display all data ?

I work on sql server 2019 i face issue i need to write join display data from table #parts based on values exist for #company in case of #company have companyid then get data related if #company table not have any companyid then get all data…

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,353 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-09-28T10:10:51.333+00:00
ahmed salah 3,216 Reputation points
edited an answer 2024-01-24T16:13:25.44+00:00
SunCrop Group 0 Reputation points
1 answer One of the answers was accepted by the question author.

Convert day, hour, minute, second (6d 5h 19m 18s) in Hour’s integer value in SQL Server

Hi All, we have a issue to convert Day, Hours, Minute, Second in Hours integer value. This is incoming data format-6d 5h 19m 18s, we need to convert this value in hours as integer value. Thanks MV

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,353 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-01-23T14:32:18.23+00:00
manish verma 441 Reputation points
commented 2024-01-24T06:31:10.15+00:00
manish verma 441 Reputation points
4 answers

How to store dynamic sql result into temporary table

This is my dynamic sql. SET @Anonymous = ' Select XX.,'''' scale,Isnull(AllowComma,''FALSE'') AllowComma,Isnull(AllowedDecimalPlace,''0'') AllowedDecimalPlace, Isnull(AllowPercentageSign,''FALSE'')…

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 2020-12-08T16:53:41.697+00:00
Sudip Bhatt 2,276 Reputation points
commented 2024-01-23T01:17:09.5333333+00:00
Verney, Thomas 0 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,353 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-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
2 answers

SCD Type 2 : MERGE Update and Insert

Hi All - I am trying to implement a Type 2 Slowly changing dimension in SQL procedure using MERGE. Here are the rules : If its a new record insert into target table with start date = getdate, end date = null and islatest =1 If the record 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,353 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-01-04T21:23:43.1333333+00:00
kkran 831 Reputation points
edited the question 2024-01-22T21:32:50.8066667+00:00
Oury Ba-MSFT 18,021 Reputation points Microsoft Employee
2 answers

SQL job get blocked after some time by a process on master DB

I have a job which performs following steps on high level 1.) Load Stage table 2.) Load Fact table 3.) Apply lots of rules on fact table, so lots of updates This was working fine for more than a year but now it gets stuck after applying some of the…

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,353 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-01-02T13:08:53.1966667+00:00
Leekha,Mohit,IN-Kolkata 0 Reputation points
commented 2024-01-22T19:06:26.2066667+00:00
GeethaThatipatri-MSFT 29,017 Reputation points Microsoft Employee
6 answers

Does SQL Table Column is assigned with column number

In Table, we can see there is number assigned automatically (line number) is the same thing is available for the columns (column number) and how can we get that number? I need a SQL query to find the column number not the number of columns.

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 2020-12-03T12:49:37.227+00:00
Sarvesh Pandey 141 Reputation points
commented 2024-01-22T16:56:00.7233333+00:00
Tom Considine 0 Reputation points
2 answers

i have a stored procedure that is complaining about a group by clause but i can see nothing wrong with it

Would someone PLEASE tell me what is wrong with this? select d.customer_no, e.sort_name, d.order_no, d.perf_no, d.season_desc, h.prod_no, b.seat_no, g.description 'section', f.seat_row, f.seat_num, a.sli_no, a.last_event, b.event_code, c.description…

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,353 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-01-19T19:38:22.0266667+00:00
Anonymous
edited a comment 2024-01-22T02:34:39.5466667+00:00
LiHongMSFT-4306 25,651 Reputation points