What do you want to save?
Add Code snippet
New code examples
-
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-21 07:34:17
sql limit results returned
-- MySql SELECT * FROM emp ORDER BY sal DESC LIMIT 5; -- SQL Server SELECT TOP 5 * FROM emp ORDER BY sal DESC; -- Oracle < 11g SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5; -- Oracle 12c + SELECT * FROM emp ORDER BY sa... Add solution -
SQL 2021-11-17 05:48:18
connect to azure sql database from python
import pyodbc server = '<server>.database.windows.net' database = '<database>' username = '<username>' password = '<password>' driver= '{ODBC Driver 17 for SQL Server}' with pyodbc.connect('DRIVER='+driver+';SERVER='+server+';P... 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 19:59:23
cursor procedure with python mssql get result
#********************************************************************** # FILENAME : CallSPMultiResultSet.py # # DESCRIPTION : # Simple ODBC (pyodbc) example to SELECT data from two tables # via a stored procedure, returning... 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 -
SQL 2021-11-08 22:25:18
sql limit results
-- MySql SELECT * FROM emp ORDER BY sal DESC LIMIT 5; -- SQL Server SELECT TOP 5 * FROM emp ORDER BY sal DESC; -- Oracle < 11g SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5; -- Oracle 12c + SELECT * FROM emp ORDER BY sa... Add solution
Best helpers
Ranking is empty