Frinds,
How can i have a script to:
1- Disable all Foreign Keys and Constraints
2- Copy all data
3- Enable all Foreign Keys and Constraints
Actually, i need the commando to enable and disable a Foreign Key.
Thanks
Leandro L S
Vitória-ES
Brazilor just use ALTER TABLE <tablename> NOCHECK CONSTRAINT ALL if you wan tto
get them all.
Note that this only disables Foreign Keys and Check constraint and not
Primary keys or unique constraints
--
Jacco Schalkwijk MCDBA, MCSD, MCSE
Database Administrator
Eurostop Ltd.
"Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
news:eTitIcjbDHA.1280@.tk2msftngp13.phx.gbl...
> Leandro,
> --To disable a Foreign key constraint
> ALTER TABLE <tablename> NOCHECK CONSTRAINT <constraintname>
> --To enable it
> ALTER TABLE <tablename> CHECK CONSTRAINT <constraintname>
>
> --
> Dinesh.
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Leandro Loureiro dos Santos" <leandro@.email.com> wrote in message
> news:%23rlB%23MjbDHA.1204@.TK2MSFTNGP12.phx.gbl...
> > Frinds,
> >
> > How can i have a script to:
> >
> > 1- Disable all Foreign Keys and Constraints
> > 2- Copy all data
> > 3- Enable all Foreign Keys and Constraints
> >
> > Actually, i need the commando to enable and disable a Foreign Key.
> >
> > Thanks
> > Leandro L S
> > Vitória-ES
> > Brazil
> >
> >
>
No comments:
Post a Comment