Tuesday, June 15, 2004 - Posts

Upcoming June 2004 Melbourne SQL Server SIG - Replication Lessons from the Real World

Tonight is the Melbourne SQL Server SIG on replication, presented by Adam Thurgar. Replication is not something I know a great deal about - I'm hoping to learn ways to sync our production and development servers as currently I use multiple DTS jobs coded by hand and scheduled with SQL Server Agent. The DTS/SQL Agent approach is very flexible, but I want simple: whenever a new table is added, data is synchronised, and the two servers are kept exactly the same.

Hopefully replication is the answer! I've printed an article from DatabaseJournal called Setting Up Merge Replication: A Step-by-step Guide to read while I'm waiting around beforehand, to at least open my eyes to what can be done.

Anyway I should have more to report on in the coming days.

Finding Stored Procedure/Table Dependencies

Recently I had a problem that I needed to update my stored procedures to point at a new set of tables. I systematically worked through my 3 stored procedures for populating the tables, but I couldn't remember all the stored procedures that accessed them for data retrieval.

Enter information_schema.routines and a tip from Experts Exchange:

select * from information_schema.routines where routine_definition like '%yourtablename%'

The downside is that this searches the stored procedure text (well, the first 4000 characters in the routine_definition column) for the table name, so you'll get hits even where the table name is used in a comment. The upside is that dynamic SQL is accounted for.