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)
 Multiple instance in stored procedure

Author  Topic 

sp3010
Starting Member

8 Posts

Posted - 2011-03-15 : 01:43:50
In the following procedure calling multiple instance of sql server located on different machines thru windows application. Application runs fine till both the servers are running but as soon as Shutdown either of machine, application stop running.

I tried to run the stores procedure on server directly with parameters but fails when either of server is down.

Pls suggest.

create procedure proc1 as
begin
if @LocCode=8 and @opIp=0
begin
SELECT * FROM [192.168.200.1\SQLEXPRESS].db1.dbo.table1
end
if @LocCode=9 and @opIp=0
begin
SELECT * FROM [192.168.201.14].db2.dbo.table1
end
end

theboyholty
Posting Yak Master

226 Posts

Posted - 2011-03-16 : 12:33:47
I think you've answered you own question here but at the risk of sounding obvious, I suggest you leave the servers running. If your SQL Server instance is running on a machine and you switch that machine off, then your query is bound to fail isn't it?

Maybe I've muisunderstood the question.

---------------------------------------------------------------------------------
http://www.mannyroadend.co.uk The official unofficial website of Bury Football Club
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-03-16 : 15:24:17
First of all the mentioned procedure will throw an error, as the variables are not declared any way.

Secondly, We would expect you to provide us some more detail of the problem and the requirements you would like to have.

Thirdly, if this is just a sample procedure to sketch the original one, then I think its the IF condition of your procedure which determines as if the application should run or not. e.g. if the machine 200.1 is turned off and the corresponding condition gets true then it will give the error and the application will not work. On the other hand if the second condition is getting true every time the application should run fine.

however if you want the application should run even if the database server is turned off then don't connect your application with the database

Cheers
MIK
Go to Top of Page
   

- Advertisement -