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 2000 Forums
 SQL Server Development (2000)
 System Errors

Author  Topic 

WalkerDA
Yak Posting Veteran

61 Posts

Posted - 2004-07-28 : 16:08:12
How can I bypass system-level errors? Here is an example, I don't want my proc. to stop, I want it recognize the error but to move on with the rest of the script. In this case the server is unavailable to query, so I want my calling script, which feeds the script that does the querying to get the next server to query and so on...

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.
[OLE/DB provider returned message: [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed]
[OLE/DB provider returned message: [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed]
[OLE/DB provider returned message: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12535: TNS:operation timed out]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBInitialize::Initialize returned 0x80004005: ].

Derrick

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-29 : 09:08:06
Can we really have 2 Derricks?

In Yukon the error handling is MUCH better.

For now, you're hosed.

What statement is failing?

You can "pre-check" if an object exists, and if not handle it that way...

But for a linked server...I don't know....

How about xp_cmdshell and ping the box?



Brett

8-)
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-29 : 09:28:58
It's sooooo confusing. I keep thinking I'm talking to myself. Then, he tells me I'm not, but I'm not sure who he is, so that doesn't really answer my question he's asking me anyway.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2004-07-29 : 14:30:13
Just don't listen when he talks about dangerous instruments....



Brett

8-)
Go to Top of Page

WalkerDA
Yak Posting Veteran

61 Posts

Posted - 2004-07-29 : 14:48:39
Pinging the box works out, good call..I'm working it into my procedure now... We have 13 boxes to check so it will add some time to our process but it's worth it... So in general however, system-level errors are just something that can not be programmed for or handled?

So if I'm using bulk insert and something is wrong with the file, the process stops and I'm screwed... Any good news?

Where are you guys located?

Derrick
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-29 : 14:51:51
Derrick ... Errrmmm ... WalkerDA

Not sure if it helps, but we use separate SProcs where this is an issue. If an SProc fails the caller generally carries on regardless (unless it does an @@ERROR check and chooses to abort

Kristen
Go to Top of Page

WalkerDA
Yak Posting Veteran

61 Posts

Posted - 2004-07-29 : 15:10:27
I assumed that would work in my case, so I used the normal
set @error = @@error

if @error <> 0
begin
print 'at least i made it this far'
end

it stopped at the error before it gets here which for system level errors is the case but the calling proc, which should indicate that an error occurred in the called proc fails as well... Generally the calling proc executes still but not in this case..I haven't spent much time investigating...

Derrick
Go to Top of Page

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-07-29 : 15:51:25
Have you thought of using a DTS task that calls the various stored procedures? They are a bit more hardy when dealing with these kind of problems.

-PatP
Go to Top of Page

WalkerDA
Yak Posting Veteran

61 Posts

Posted - 2004-07-29 : 16:04:30
A good question..unfortunately, the project time out ways the project expectations..therefore, I haven't a clue of how to automate DTS and feed it paramters on the fly and the time that I have to kick this out was basically not enough. So in some cases I've used ActiveX scripts to get the job done where DTS may offer similar benefits. At some point I want to become a bit more familiar with it but outside the use of wizards I'm sunk..any good references or learning aids?

Derrick
Go to Top of Page
   

- Advertisement -