Here are some ways to get our sql run time
- This way will more comprehensive
set statistics profile on
set statistics io on
set statistics time on
go
......--your sqls
go
set statistics profile off
- 2.
declare @begin_date datetime
declare @end_date datetime
select @begin_date = getdate() --also can use [set]
......--your sqls
select @end_date = getdate() --also can use [set]
select datediff(ms,@begin_date,@end_date) as 'time'
Here we can refer to DATEDIFF
Let use it in our actual work jobs~~