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)
 Alter Table

Author  Topic 

SQLSeeker
Starting Member

15 Posts

Posted - 2009-12-22 : 08:33:51
Hi,
In my database I have 3 tables with same schema with different names. When I alter one table, I want same changes to other two also.
How can I achieve this without altering other two manually.

Thanks

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2009-12-22 : 09:49:38
We use Red Gate's SQL compare Tool. http://www.red-gate.com

I don't know of anyway in SSMS except if you altered the first table with an SQL command, then apply that same command to the other 2 tables.
Go to Top of Page

shan
Yak Posting Veteran

84 Posts

Posted - 2009-12-22 : 10:54:22
Try using ddl triggers

http://www.sqlteam.com/article/using-ddl-triggers-in-sql-server-2005-to-capture-schema-changes

Thanks
Shan
Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2009-12-22 : 11:06:12
quote:
Originally posted by shan

Try using ddl triggers

http://www.sqlteam.com/article/using-ddl-triggers-in-sql-server-2005-to-capture-schema-changes

Thanks
Shan



Thankyou. That's a darn good idea.

I was think of something sort of similar by putting a trigger on sys.sql_modules, which would be good for Views, functions Stored Procs but not for tables. But then I thought to put a trigger on a sys table was questionable.
Go to Top of Page
   

- Advertisement -