4,712 questions with Developer technologies | Transact-SQL tags
fast farward curson vs while loop on @table
hi, need to known weather fast farwand cursor is faster than a while loop made on @table variable haveing less than 15 rows that means 15 iteration. pls tell me which one is faster.
Developer technologies | Transact-SQL
Export data from Excel to MS SQL Server
Hi, We have an excel that stores data in it. Some forms are created inside it that are not tabular in structure. So we can consider excel sheets act as individual pages as in any website. now we need to pull data from excel into database. I…
Microsoft 365 and Office | Development | Other
Microsoft 365 and Office | Excel | For business | Windows
Developer technologies | Transact-SQL
SQL Server | Other
How to trap errors in Agent Job execution
I have an agent job with several steps, each step executing a stored proc. A few times each year, when a step EXEC takes place, there's no response, the proc doesn't run at all, and the step quits upon failure. I have error checking in the proc, but I…
Developer technologies | Transact-SQL
Convert 14 Char String to Datetime
I have a field in a table called TraceID that stores data like this: 2024040611102200021 The first 8 characters represent the date (YYYYMMDD). The next 6 characters represent the time (HHMMSS). The last five are insignificant numbers. So this would be…
Developer technologies | Transact-SQL
SQL Server | Other
Preventing Database Deletion in SSMS
prevent accidental database deletions within SQL Server Management Studio (SSMS). Currently, I am exploring options to enforce this restriction effectively implemented a DDL trigger Is the above DDL trigger approach appropriate for preventing…
SQL Server on Azure Virtual Machines
Developer technologies | Transact-SQL
SQL Server | Other
MERGE Statement results in a Cannot insert duplicate key in object
So we have a MERGE Statement that looks as though it should do the INSERT on NOT MATCHED and the UPDATE on MATCHED correctly. However when processing for some reason it seems to be falling into the NOT MATCHED INSERT portion of the MERGE rather than the…
Developer technologies | Transact-SQL
can the ROW_NUMBER() function be used without the PARTITION clause?
I'd like to get row numbers for my output without having to use ROW_NUMBER() OVER(PARTITION BY ...). Is this possible, and can you provide an example?
Developer technologies | Transact-SQL
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
SSIS using Kingswaysoft
Hi Team, I want to do the On prem CRM migration from 8.1 to 9.1 where we have a 9 TB SQL data which is the big challange for us. Someone suggested to do this using Kingswaysoft tool which handles a large data migration. Could you please provide us…
Developer technologies | Transact-SQL
How can convert decimal value into time format as its
How can change to decimal values in to time format as it is without any change in values declare @intime decimal (10,2) = 7.50 declare @intime1 decimal (10,2) = 17.50 declare @breakhrs decimal (10,2) = .45 declare @breakhrs decimal (10,2) = 1.00 …
Developer technologies | Transact-SQL
sp_prepare and sp_execute vs sp_executesql
I have noticed sp_executesql also makes a single plan for a stmt when a stmt is calle in a loop. Generally plan is evicted from cache from first in first out or usage basis.so if i use sp_executesql then i should be fine in a loop in stored procedure…
Developer technologies | Transact-SQL
MSDN forum directs me to here
Hello all, I go to this link: https://social.msdn.microsoft.com/Forums/en-US/home and it directs me to : https://learn.microsoft.com/en-us/answers/questions/ask.html?WT.mc_id=msdnredirect-web-msdn Does anyone know what the reason is? …
Developer technologies | Transact-SQL
Looking for SQL Server 2019 Architecture Diagram
I am looking for an Architecture Diagram for SQL Server 2019. Can someone point me to a web site? I cannot find anything current.
Developer technologies | Transact-SQL
SQL Server | Other
Why there are null values in stop_execution_date column of msdb.dbo.sysjobactivity table
Hello, We are using below code to identify and stop running SQL Server Agent jobs. SELECT 1 FROM msdb.dbo.sysjobs_view job INNER JOIN msdb.dbo.sysjobactivity activity ON (job.job_id = activity.job_id) …
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
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
Error handler would not be running in case of sequence error
Group Because leaving my sequence name incorrect ( sqc_LogReplic_tmpx ) it would not be entering the error handling routine. And adjusting to the correct name ( sqc_LogReplic_tmp ) and the routine executing the division by 0 instruction would…
Developer technologies | Transact-SQL
SQL Server | Other
How to debug SP procedure from SSMS
My sql server database is Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Aug 22 2017 17:04:49 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) i want to…
Developer technologies | Transact-SQL
SQL Server | Other
SQL Server: query performance
I would like to write a fast query returning the data that the following query returns: SELECT M,COmb,Mod,Loc,Initial, Final,Kms_,R,Franq,Num_Fleet,Pneus,Cli,Active,Interv, Cost1,Cost2,Name,Colab_Cod,col.colName FROM tFleetCars AS v OUTER APPLY ( …
Developer technologies | Transact-SQL
SQL Server | Other
Performance of View with where clause
I have a table say employee(employeeid,employeename,salary,dateofbirth) which has around 1M+ records.. now i have created a view as below (i) create view vw_emp as select * from employee my question is:- what is the impact of performance if i…