Record (Print) Stored Procedures execution time (start and end) in SQL Server

nabilabolo
 
on May 05, 2021 03:35 AM
672 Views

Hi,

I want to do some data integration from oracle to SQL Server. I want to check how long the integration take for one process and i have multiple process in that integration. I plan to include start time and end time for each process in stored procedure and save it in db but i don't know how to do it. 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on May 05, 2021 03:38 AM

Hi nabilabolo,

You can do it in this way.

  1. DECLARE 2 datetime variables: start and end
  2. SET start = GETDATE()
  3. EXEC SP_NAME
  4. SET end = GETDATE()
  5. Execution time - difference between end and start