Thursday, March 22, 2012

delete

I have a need to delete records from a table, since the
table has FK constraints, it doesn't allow me to issue
delete.
I want to delete records from this table and repopulate
it from the backup. Since I don't want to manually
check all the dependencies, Is there any way by which
I can just delete from this table and still maintain
all dependencies with other tables? I don't want to
drop so that I don't have to create indexes, etc.
Thanks for your help!
Asok
Have you tried either dropping the FK constraints or
alter table x nocheck constraint all
then try the delete
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Asok" <anonymous@.discussions.microsoft.com> wrote in message
news:1b13c01c44fe2$f931cc10$a601280a@.phx.gbl...
> I have a need to delete records from a table, since the
> table has FK constraints, it doesn't allow me to issue
> delete.
> I want to delete records from this table and repopulate
> it from the backup. Since I don't want to manually
> check all the dependencies, Is there any way by which
> I can just delete from this table and still maintain
> all dependencies with other tables? I don't want to
> drop so that I don't have to create indexes, etc.
> Thanks for your help!
> Asok
|||Hi Wayne,
I think this is what I was looking for. I think it will
work, but after that when I restore the data in this
table, will it maintain the constraints? Do you have any
idea about it? I want to make sure before I fiddle with
this table as it has lot of dependecies associated.
If it was just couple of them, I would have taken a
chance.
Thank you for your time,
-Asok

>--Original Message--
>Have you tried either dropping the FK constraints or
>alter table x nocheck constraint all
>then try the delete
>--
>Wayne Snyder, MCDBA, SQL Server MVP
>Mariner, Charlotte, NC
>www.mariner-usa.com
>(Please respond only to the newsgroups.)
>I support the Professional Association of SQL Server
(PASS) and it's
>community of SQL Server professionals.
>www.sqlpass.org
>"Asok" <anonymous@.discussions.microsoft.com> wrote in
message
>news:1b13c01c44fe2$f931cc10$a601280a@.phx.gbl...
>
>.
>

No comments:

Post a Comment