You are here: Re: How to Disable ALL Constraint In ALL Tables « MsSQL Server « IT news, forums, messages
Re: How to Disable ALL Constraint In ALL Tables

Posted by Martijn Tonies on 10/01/38 11:19

> This should do what you need on your current database
>
> declare @tablename varchar(30)
> declare c1 cursor for select name from sysobjects where type = 'U'
> open c1
> fetch next from c1 into @tablename
> while ( @@fetch_status <> -1 )
> begin
> exec ( 'alter table ' + @tablename + ' check constraint all ')
> fetch next from c1 into @tablename
> end
> deallocate c1
> go

Easy iteration can be done via
master.sp_MSforeachtable :-)


--
With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация