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
 General SQL Server Forums
 New to SQL Server Programming
 What is the best approach to following issue?

Author  Topic 

mrtweaver
Yak Posting Veteran

67 Posts

Posted - 2010-11-15 : 09:08:46
Greetings. Running SQL 2005.

We have a view that jumps across to a different server to obtain its data. The application we have developed relys heavily on this data. The issue is sometimes for a reason which eludes our IT staff the connection between the two servers gets disconnected.

What we have done to keep this issue from crashing our application is we have copied the data from the view and placed it in a table. THis is somewhat good but now we are looking for ways to automatically update the table with data from the view.

So I am looking for assistance in what would be the best approach.

I am thinking Execute the view, if an error occurs while executing the view send an alert, however if the view returns good data then either delete the old data in the table and place in all the new data or simply update the table with the new data.

Where I am having difficulty is figuring out the best way to see if their is data from the execution of the view.

One programmer had this idea: First do a count(*) on the view from within a stored proceedure, then do a IF COUNT(*)>0 THEN (do the select and update) ELSE (send alert). But I am unsure if this doing the COUNT would false trigger and still perform an update or what.

SO I am asking the GURU community here would this idea work or is there a better approach.

Thanks and have a great day.

TimSman
Posting Yak Master

127 Posts

Posted - 2010-11-15 : 09:14:44
What about replication?
Go to Top of Page

mrtweaver
Yak Posting Veteran

67 Posts

Posted - 2010-11-15 : 09:16:50
I am still very much a green horn when it comes to this SQL world. I have been learning as I go. DOnt know much about this replication you speak of.



quote:
Originally posted by TimSman

What about replication?

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-11-15 : 09:37:57
I concur. Transactional replication sounds like it would work well here. That way, unless the replication has failed, the table will always be up to date, within a minute or so, and no checks are required.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -