Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Lijo Cheeran Joseph
Posting Yak Master
123 Posts |
Posted - 2011-07-21 : 07:47:34
|
Hi,I am trying to run a SQL statement to disable trigger on a table. I am getting the following error."Could not locate entry in sysdatabases for database 'DISABLE TRIGGER dbo'. No entry found with that name."How do I modify it to run successfully?DECLARE @Statement VARCHAR(1000)SET @Statement = 'DISABLE TRIGGER dbo.Trigger_audit_Area ON dbo.Area'EXEC @StatementThanks |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-07-21 : 07:58:24
|
alter table YourTable disable trigger triggernameand I see no need for dynamic sql... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
Lijo Cheeran Joseph
Posting Yak Master
123 Posts |
Posted - 2011-07-21 : 08:01:47
|
I have 300 tables. I want to disable the tirggers on all of them programmatically. Can you please tell me how to do that? |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-07-21 : 08:10:03
|
Try:use YourDatabasegosp_msforeachtable 'ALTER TABLE ? DISABLE TRIGGER all' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
Lijo Cheeran Joseph
Posting Yak Master
123 Posts |
Posted - 2011-07-25 : 11:33:49
|
Thanks....sp_msforeachtable helped. |
 |
|
|
|
|