Skip to content

Instantly share code, notes, and snippets.

View mwittmann's full-sized avatar

Martin Wittmann mwittmann

  • Seattle
  • 03:24 (UTC -07:00)
View GitHub Profile
@mwittmann
mwittmann / dropall.sql
Last active April 28, 2020 00:57 — forked from jammycakes/dropall.sql
A script to drop all objects from a SQL Server database
-- Support for multiple schema names; drop all table constraints
--------------------------------------------------
declare @name varchar(100)
declare @table varchar(100)
declare @schema varchar(100)
-- Drop all table constraints: this goes through alter table
declare c cursor for
select a.name as [constraint], b.name as [table], OBJECT_SCHEMA_NAME(b.id) as [schema]