4,707 questions with Developer technologies | Transact-SQL tags
Calculating Elapsed Time From Start & End Time
Hi, Running SQL Server 2008 R2. I have the following sample table: CREATE TABLE [dbo].[Test] ( [Test_ID] [int] NOT NULL, [Start_Time] [char](5) NULL, [End_Time] [char](5) NULL, [Elapsed_Time] [char](5) NULL, CONSTRAINT …
Developer technologies | Transact-SQL
which is best for performance filtering on where or filtering on join ?
I work on sql server 2019 i don't know which is best for performance filtering on where condition or filtering on join with another meaning which is best first query select A.* from A inner join B on A.ID=B.ID INNER JOIN C ON C.ID=B.ID …
Developer technologies | Transact-SQL
SQL Server | Other

Can you recommend a sql formatter?
Dear colleagues, Which SQL formatter would you recommend? In our organization, we have coding standards. My problem is, there are to many of them. As I am responsible for the repositories containing SQL, I want to enforce a single standard by…
Developer technologies | Transact-SQL
SQL Server | Other

Stored Procedure not executing as SQL Agent Job
I have a stored procedure (1) that updates JSON data (via JSON_Modify()) in an auditing table to replace raw binary with a short string 'Binary column data.'. This stored procedure functions when executed in SSMS, but when I try to have a SQL Agent Job…
Developer technologies | Transact-SQL
SQL Server | Other

To identify the performance of sqlserver between 1 month of different years.
Hi, How can I identify the performance load of SQL Server between 2 period of different years, Any script to calculate the I/O load and performance of SQL Server. I s there any tools to identify the performance and I/O load on SQL Server between 2…
Developer technologies | Transact-SQL
SQL Server | Other
Pull values to the Left of a dash
I am trying to pull from a field called "Location" that includes a number of varying lengths after a dash. I only want to pull the value of the field before the dash. My expression below worked with the LTRIM to pull values after the dash but…
SQL Server Reporting Services
Microsoft 365 and Office | Excel | For business | Windows

Developer technologies | Transact-SQL

What are the advantages always square brackets sql server objects inside procedure
Hi What are the advantages always square brackets sql server objects inside procedure? --proc format 01 CREATE [schema].[Proc_getdata01] AS BEGIN SELECT [column01],[column01] FROM [schema].[table] WHERE [column03]='01'; END GO --proc format…
Developer technologies | Transact-SQL
SQL Server | Other
IF EXIST UPDATE, IF NOT EXIST INSERT
Hi, i want to know how update a row if exist and if don't exist insert a new row Example:
Developer technologies | Transact-SQL
SQL Server | Other
Getting this error: Msg 3609, Level 16, State 1, Line 88 The transaction ended in the trigger. The batch has been aborted.
So I'm trying an exercise Trigger Code that would send an email if someone tries to insert into the adventure database a special offer that is equal to or greater than 80%, My Code goes Like this: ----------------------- The…
Developer technologies | Transact-SQL
SQL Server | Other
BACKUP LOG Write Fail to Azure Storage
Hello, We have a SQL VM running out of Azure with SQL Agent jobs running BACKUP LOG every x hours to Azure Blob. These jobs have been running fine for a long time until recently. We keep getting the below error and these jobs fail intermittently for…
SQL Server on Azure Virtual Machines
Azure Storage
Developer technologies | Transact-SQL
SQL Server | Other
How to call multiple Store Procedures in parallel in MS SQL
Hi All, I have 3 store procedures in MSSQL DB. EXEC sp_test_1 (ID) GO EXEC sp_test_2 (ID) GO EXEC sp_test_3 (ID) GO When I execute each store procedure is taking 15 minutes to complete and total of 45 minutes. When I…
Developer technologies | Transact-SQL
SQL Server | Other
Grant access only to a Schema in SQL
Hi All, I have a Database called TM1 and in this database I have 2 schemas. One is called TMS1 and another is called TM1App. There are 5 views under schema TMS1. For Example: TMS1 .View1, TMS1 .View2....TMS1 .View5. These views are reading data from…
Developer technologies | Transact-SQL

Unable to open the physical file. Operating system error 5: “5(Access is denied.)”
I am trying to work on a query to attach a database (UNC path) remotely. I have SQL Server management studio (SSMS) installed in SQL Server machine (machineSQL) and also in another machine (machineRemote) in same domain. Query:: CREATE DATABASE…
Developer technologies | Transact-SQL
SQL Server | Other
how to calculate age from date of birth
im required to come up with a script for a solution where you need both peoples date of birth, and age, when registering them its clearly stated that the person wont be asked to input their age, just their dob. but the age is needed what needs to be…
Developer technologies | Transact-SQL
Text and NVARCHAR are incompatible
Hi, I am trying to join 2 tables together but once column is a text, and the other nvarchar and as a result, I get the following error message Msg 402, Level 16, State 1, Line 101 The data types text and nvarchar are incompatible in the equal to…
Developer technologies | Transact-SQL
SQL Server | Other
SQL server. Updated data is lost and reverted back to the past data
SQL SERVER. I have a database that works fine and saves the update of the data and i see that data updated, but after a possible week or month, I find that the data returns to its original position before the modification and the modification completely…
Developer technologies | Transact-SQL
SQL Server | Other
How to Get SQL Logs (UPDATE, INSERT and DELETE)of Specific Table from SQL Server if Query run from Website.
Hi, How to Get SQL Logs (UPDATE, INSERT and DELETE)of Specific Table from SQL Server if Query run from Website. Please Help
SQL Server Reporting Services
SQL Server Analysis Services
Developer technologies | Transact-SQL
SQL Server | Other
Best Practice to Decide Partition Table in SQL Server
Hi All, We have a database on SQL server with a large size (about 20 TB) and we plan to partition the existing tables in the database. but we are still confused to determine whether to partition the table, whether it should be partitioned…
SQL Server Analysis Services
Developer technologies | Transact-SQL
SQL Server | Other

iNLINE PIVOT QUERY SYNTAX ERROR
a PIVOT query runs without error on its own but gets a syntax query when made into an inline query
Developer technologies | Transact-SQL
How to delete Old database backup files from Azure blob container through Using T-SQL script without using any Azure CLI and PowerShell commands.
Here is the corrected version of your sentence: We are facing an issue with deleting old backup files from the Azure Blob container. Our company is not willing to spend money on this deletion activity. Please let me know how to delete old database…
Developer technologies | Transact-SQL
