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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Creating a job to altering Trigger

Author  Topic 

Johnho008
Starting Member

24 Posts

Posted - 2008-05-22 : 10:47:35
Hi Everyone,

I have a database which once every week gets backup/restored and then renamed for training purpose. The problem is that I got trigger on some of the tables and once the database gets renamed the trigger failed to work as it referring to the old database name. I have idenify all the trigger and done a ALTER TRIGGER. However I can't seem to get it to run as a JOB. Tried to create a store procedure but get a error as the ALTER TIGGER is after CREATE PROCEDURE I could do it as a SQLstring but theirs alot of trigger, want to know if there any other ways of doing it. Please help

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-05-22 : 22:57:15
How did you run that in sql job? Try create a sql script for alter trigger, then call it with sqlcmd in sql job. By the way, why hardcode db name in triggers?
Go to Top of Page

Johnho008
Starting Member

24 Posts

Posted - 2008-05-23 : 06:13:52
Thanks Rmiao, will give it a try. Its a third party CRM system hence why its all hardcoded
Go to Top of Page
   

- Advertisement -