Patrick Wright

Pat Wright's SQL Blog

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910


Navigation

User Groups

Bloggers I read

Conference info

Subscriptions



SQL Cmd Issues

 

The script below should give you the servername for each server you connected to.  But what if the second one is offline?  Or perhaps you don’t have login permission to it?  Then it should ignore the error and go to the third one right?  No it doesn’t.  For some reason on error ignore seems to do just about nothing. I’ve tried it in lots of different methods in this script and I can’t get it to ignore and keep going.  Anyone else run into this? 

:connect sqllaunchvpc
select srvname from master..sysservers where srvid = 0
GO

:connect sqllaunchvpc\sqldev01
:ON ERROR ignore
select srvname from master..sysservers where srvid = 0
GO

:connect sqllaunchvpc\sqldev02
:ON ERROR ignore
select srvname from master..sysservers where srvid = 0
GO

 

 

 

Pat

 

posted on Friday, March 03, 2006 1:16 PM by pwright77


# sqlcmd error handling @ Tuesday, March 07, 2006 9:36 PM

I did manage to work while in Barcelona last month, not just to visit. I delivered a session on sqlcmd,...

Anonymous

# Haidong Ji - sqlcmd error handling @ Wednesday, March 08, 2006 11:26 PM

Anonymous

# re: SQL Cmd Issues @ Thursday, March 09, 2006 1:09 PM

Thanks for the update Ji and i did get off to your blog. I just hate my feedback here! Think i need a new blog! :)

pwright77




Powered by Dot Net Junkies, by Telligent Systems