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