What do you want to save?
Add Code snippet
New code examples
-
SQL 2022-02-14 10:50:01
how to get one year old query from plan cache
SELECT TOP 10 t.TEXT QueryName, s.execution_count AS ExecutionCount, s.max_elapsed_time AS MaxElapsedTime, ISNULL(s.total_elapsed_time / 1000 / NULLIF(s.execution_count, 0), 0) AS AvgElapsedTime, s.creation_time, ISNULL(s.execution_count / 1000 / NULLIF(D... Add solution -
SQL 2022-02-03 09:03:35
create a quick temp table with stored procedure sql
/* First you need to create a table type. */ CREATE TYPE Names AS TABLE (Name VARCHAR(10)) ; GO /* Next, Create a procedure to receive data for the table-valued parameter, the table of names and select one item from the table*/ CREATE PROCEDURE Ch... Add solution -
SQL 2022-01-22 02:15:02
drop all tables in azure sql database
while(exists(select 1 from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where CONSTRAINT_TYPE='FOREIGN KEY')) begin declare @sql nvarchar(2000) SELECT TOP 1 @sql=('ALTER TABLE ' + TABLE_SCHEMA + '.[' + TABLE_NAME + '] DROP CONSTRAINT [' + CONSTRAINT_NAME + ']'... Add solution -
SQL 2021-11-13 13:55:17
userdefined function cross apply all days into the future sql
USE Northwind GO SELECT o1.OrderID, o1.OrderDate, ca.OrderID AS NextOrder, ca.OrderDate AS NextOrderDate, CustomerID, DATEDIFF(DAY, o1.OrderDate,ca.OrderDate) DaysToNextOrder FROM Orders AS o1 CROSS APPLY (SELECT TOP 1 o.OrderDate, o.OrderID ... Add solution -
SQL 2021-11-10 04:49:15
ms sql how to see active job current run time
SELECT ja.job_id, j.name AS job_name, ja.start_execution_date, ISNULL(last_executed_step_id,0)+1 AS current_executed_step_id, Js.step_name FROM msdb.dbo.sysjobactivity ja LEFT JOIN msdb.dbo.sysjobhistory jh ON ja.job_histor... Add solution
Best helpers
Ranking is empty