显示标签为“rid”的博文。显示所有博文
显示标签为“rid”的博文。显示所有博文

2012年2月25日星期六

Disabling or Getting Rid of Foreign Keys So I Can Drop My Table

Kinda new to SQL, using SQL Server 2005.

I have some foreign keys in a couple of tables. I need to drop these
tables, but can't since I'll get the error:

Msg 3726,

Level 16, State 1, Line 1
Could not drop object 'Client' because it is referenced by a FOREIGN
KEY constraint.

I'm not sure how to disable or get rid of these foreign keys so that I
can drop my tables. I tried:

ALTER TABLE Client NOCHECK CONSTRAINT ALL

Alter Table Client Drop Column Foreign Key Boss_ID;

I went into the Object Explorer and deleted the FK lines from each
table, but still the same error.

What am I doing wrong?

Thanks for your help.apax999@.gmail.com (apax999@.gmail.com) writes:

Quote:

Originally Posted by

Kinda new to SQL, using SQL Server 2005.
>
I have some foreign keys in a couple of tables. I need to drop these
tables, but can't since I'll get the error:
>
Msg 3726,
>
Level 16, State 1, Line 1
Could not drop object 'Client' because it is referenced by a FOREIGN
KEY constraint.
>
I'm not sure how to disable or get rid of these foreign keys so that I
can drop my tables. I tried:
>
ALTER TABLE Client NOCHECK CONSTRAINT ALL
>
Alter Table Client Drop Column Foreign Key Boss_ID;
>
I went into the Object Explorer and deleted the FK lines from each
table, but still the same error.


You need to drop the foreign keys from the tables that references
Client, not the FKs of Client itself. Say there is an Orders table
with a column ClientID. Then you need to drop that FK constraint.
Then again, this would mean that the client ids in Orders would
be hanging in thin air. Of course, if you create the table, and
repopulate, it may be OK. But don't forget to reapply the foreign
keys you dropped.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

2012年2月14日星期二

Disable Event Logging to Windows Application Log?

Hi,

We are starting to work with SSIS in our production environment & due to support issues; we are trying to get rid of the "Package xxx started" log entries inside of the Windows Application Event Log...

So far, I have tried many different things, including setting the LoggingMode to "Disabled", as well as adding a new logging reference with a different destination... All of which still do not get rid of the extra log entries...

Is this possible? & does anyone know how to get this done?

Thanks!

I am having this same problem. Have you had any luck with this?

I have LoggingMode disabled in the properties of the package, I don't have anything checked on the Configure SSIS Logs screen in the Containers list nor on the Providers and Logs tab and the Details tab. The packages are being run from a SQL Server Agent job.

Thanks.

Bobette

|||

I move the thread to SQL Server Tools general because this looks like and SQL Agent problem

Thanks,
Ovidiu

|||

Hi,

Unfortunately I still haven't found a way to get this accomplished... At least I'm not the only one with the same problem.. . :) Thanks Bobette..

For now, we are simply living with the problem & have built a custom app that queries the event log for error's only... But this isn't a solution, just a band-aid...

~James

|||

Hopefully someone that knows will find our posting here. Thanks for the quick reply!

bobette

|||

After I read your poost twice I realized this is a SSIS thing.

The current implementation will always post the "Package xxx started" event and there is no way to disable this message

Thanks,
Ovidiu Burlacu

|||

Thanks! At least I know to quit trying to figure it out.

Bobette

Disable Event Logging to Windows Application Log?

Hi,

We are starting to work with SSIS in our production environment & due to support issues; we are trying to get rid of the "Package xxx started" log entries inside of the Windows Application Event Log...

So far, I have tried many different things, including setting the LoggingMode to "Disabled", as well as adding a new logging reference with a different destination... All of which still do not get rid of the extra log entries...

Is this possible? & does anyone know how to get this done?

Thanks!

I am having this same problem. Have you had any luck with this?

I have LoggingMode disabled in the properties of the package, I don't have anything checked on the Configure SSIS Logs screen in the Containers list nor on the Providers and Logs tab and the Details tab. The packages are being run from a SQL Server Agent job.

Thanks.

Bobette

|||

I move the thread to SQL Server Tools general because this looks like and SQL Agent problem

Thanks,
Ovidiu

|||

Hi,

Unfortunately I still haven't found a way to get this accomplished... At least I'm not the only one with the same problem.. . :) Thanks Bobette..

For now, we are simply living with the problem & have built a custom app that queries the event log for error's only... But this isn't a solution, just a band-aid...

~James

|||

Hopefully someone that knows will find our posting here. Thanks for the quick reply!

bobette

|||

After I read your poost twice I realized this is a SSIS thing.

The current implementation will always post the "Package xxx started" event and there is no way to disable this message

Thanks,
Ovidiu Burlacu

|||

Thanks! At least I know to quit trying to figure it out.

Bobette

Disable Event Logging to Windows Application Log?

Hi,

We are starting to work with SSIS in our production environment & due to support issues; we are trying to get rid of the "Package xxx started" log entries inside of the Windows Application Event Log...

So far, I have tried many different things, including setting the LoggingMode to "Disabled", as well as adding a new logging reference with a different destination... All of which still do not get rid of the extra log entries...

Is this possible? & does anyone know how to get this done?

Thanks!

I am having this same problem. Have you had any luck with this?

I have LoggingMode disabled in the properties of the package, I don't have anything checked on the Configure SSIS Logs screen in the Containers list nor on the Providers and Logs tab and the Details tab. The packages are being run from a SQL Server Agent job.

Thanks.

Bobette

|||

I move the thread to SQL Server Tools general because this looks like and SQL Agent problem

Thanks,
Ovidiu

|||

Hi,

Unfortunately I still haven't found a way to get this accomplished... At least I'm not the only one with the same problem.. . :) Thanks Bobette..

For now, we are simply living with the problem & have built a custom app that queries the event log for error's only... But this isn't a solution, just a band-aid...

~James

|||

Hopefully someone that knows will find our posting here. Thanks for the quick reply!

bobette

|||

After I read your poost twice I realized this is a SSIS thing.

The current implementation will always post the "Package xxx started" event and there is no way to disable this message

Thanks,
Ovidiu Burlacu

|||

Thanks! At least I know to quit trying to figure it out.

Bobette