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
 Other SQL Server Topics (2005)
 Query to Change Server Pointers

Author  Topic 

BRishel
Starting Member

5 Posts

Posted - 2008-12-17 : 14:56:50
Hello,

I currently have a extremely large database containing 100+ tables, some with half a million + records. I am working on a project to create a script that will search through the entire database (or even just the tables I choose) and have the script look for any records that point towards "Server1" and have it change that pointer to "Server2".

This way if Server 1 goes down, I can load the script and run it and have the script change every instance through out the database where it finds "server1" and have it changed to "Server2"

I have been looking at using an IF THAN statement with an UPDATE command but have not had much luck.

I normally handle the Network side of our IT but as we are exteremly busy I am helping out with some SQL work.

Any help is greatly appreciated.

Bryan Rishel
Jackson, Michigan

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-17 : 15:01:05
Why do you have server information hard-coded into the database?

Your database doesn't sound big with only 100+ tables and half a million+ rows. How many gigabytes is it?

You could use Vyas' code: http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

BRishel
Starting Member

5 Posts

Posted - 2008-12-17 : 15:09:00
Thank you very much for your quick response, I will play around with this and see what I get.

We have 25 different databases running on a SQL Cluster. This one specific database is over 120gb.

Bryan Rishel
Jackson, Michigan
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-17 : 15:17:18
120GB is big, but not extremely big. Wait til you get to the terabytes!

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

BRishel
Starting Member

5 Posts

Posted - 2008-12-17 : 15:18:43
This does look like it will come in handy for sure. Thank you again for your quick response and help!

Bryan Rishel
Jackson, Michigan
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-17 : 15:19:32
You're welcome. Let us know if you have any other questions.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -