Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Handy SQL Server Queries

DZone's Guide to

Handy SQL Server Queries

· Database Zone ·
Free Resource

RavenDB vs MongoDB: Which is Better? This White Paper compares the two leading NoSQL Document Databases on 9 features to find out which is the best solution for your next project.  

These two queries are great when you need to apply some bulk actions...

 

Drop all FK's in a database

SELECT 'ALTER TABLE ' + TABLE_SCHEMA + '.' + TABLE_NAME +

' DROP CONSTRAINT ' + CONSTRAINT_NAME

FROM information_schema.table_constraints

WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'


Drop all tables in a database

exec sp_MSforeachtable "DROP TABLE ? PRINT '? dropped' "


Original post at http://www.steveciske.com/post/Handy-SQL-Queries.aspx

Do you pay to use your database? What if your database paid you? Learn more with RavenDB.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}