I am using SQL Server 2000. I have some files with SQL-Statements.
The SQL-Serveragent runs jobs which execute the SQL-Files:
(e.g. osql /E /n /i \\server\d$\lag er_pool.sql)
How can I implement an error handling.
If an error occurs, the script stops, and I can't read the variable
@error
My script - table xy doesn´t exist
SELECT * FROM XY
SELECT @@error
SELECT 33
The execution stops with an error after the first line
Thanks for your help.
aaapaul 3 1544
Hi
Look at using the -b flag when you call osql, there is more information in
Books Online.
John
<lv****@gmx.net > wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
I am using SQL Server 2000. I have some files with SQL-Statements.
The SQL-Serveragent runs jobs which execute the SQL-Files:
(e.g. osql /E /n /i \\server\d$\lag er_pool.sql)
How can I implement an error handling.
If an error occurs, the script stops, and I can't read the variable
@error
My script - table xy doesn´t exist
SELECT * FROM XY
SELECT @@error
SELECT 33
The execution stops with an error after the first line
Thanks for your help.
aaapaul
Thanks, but it doesn´t work
This is my script - its a file c:\test.sql
declare @errorcode int
select * from abc
SET @errorcode = @@error
--writing log
insert adaten.dbo.logh ist(logdatum,lo ginfo,logfehler ,saetze)
values (getdate(),'tes t',@errorcode,2 5)
The table "abc" don´t exist.
If I call the script
osql /E /n /ic:\test.sql (with or without /b) the insert anweisung
instruction won´t be executed.
I want something like ON ERROR RESUME NEXT. Is this possible ?
Thanks
aaapaul
Hi
You may want to try using EXEC for your select statement
declare @errorcode int
EXEC ('select * from abc')
SET @errorcode = @@error
--writing log
insert adaten.dbo.logh ist(logdatum,lo ginfo,logfehler ,saetze)
values (getdate(),'tes t',@errorcode,2 5)
John
<lv****@gmx.net > wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Thanks, but it doesn´t work
This is my script - its a file c:\test.sql
declare @errorcode int
select * from abc
SET @errorcode = @@error
--writing log
insert adaten.dbo.logh ist(logdatum,lo ginfo,logfehler ,saetze)
values (getdate(),'tes t',@errorcode,2 5)
The table "abc" don´t exist.
If I call the script
osql /E /n /ic:\test.sql (with or without /b) the insert anweisung
instruction won´t be executed.
I want something like ON ERROR RESUME NEXT. Is this possible ?
Thanks
aaapaul This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christian Christmann |
last post by:
Hi,
assert and error handling can be used for similar purposes.
When should one use assert instead of try/catch and in which
cases the error handling is preferable?
I've read somewhere that assert could be used to start
an interactive debugger automatically. How do I realize that
on a Linux machine using gcc?
|
by: claus.hirth |
last post by:
If I create the function HELLO in schema S01 as follows,
@
CREATE FUNCTION S01.HELLO()
RETURNS VARCHAR(32)
EXTERNAL NAME 'UDFSRVXYZ!sayHelloWorld'
LANGUAGE JAVA
PARAMETER STYLE DB2GENERAL
NO SQL
DETERMINISTIC
|
by: annie |
last post by:
Hi all,
I have recently ported my Access 2000 app to SQL Server, keeping the
Access client as the front end using linked tables.
I am also using triggers on my SQL tables to trap orphan records and
validate added data.
My question is..
|
by: Steve Jorgensen |
last post by:
I'm trying to figure out if there is a way to generate standard error handlers
that "know" if the calling code has an error handler in effect (On Error Goto
<label> or On Error Resume Next) before deciding how to respond. Does anyone
know if this is possible.
|
by: Steve Jorgensen |
last post by:
When writing VB or VBA code that works with databases or other external
libraries that cannot be trusted to automatically do the right thing when
references to their objects are arbitrarily released, some thought must be put
into how to make sure the objects will all be closed and released in the
correct order, even in the result of an error.
This requirement can make our code really ugly, even following the best of
commonly known best...
| |
by: Alberto Giménez |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi there! I'm doing some homework (almost finished), but now i'm
reconsidering a design decission I made at the beginning. This is about
error handling in functions. I have my functions returning 0 if OK, and
an "enum" error indicating the type of error. A typical pseudo-code is
like:
|
by: James Radke |
last post by:
Hello,
I am looking for guidance on best practices to incorporate effective and complete error handling in an application written in VB.NET. If I have the following function in a class module (note that this class module represents the business layer of code NOT the gui layer):
Public Function Test(ByVal Parm1 As Integer, ByVal Parm2 As Integer) As SqlDataReader
' Declare the SQL data layer class
Dim oSQL As New...
|
by: snicks |
last post by:
I'm trying to exec a program external to my ASP.NET app using the following
code. The external app is a VB.NET application.
Dim sPPTOut As String
sPPTOut = MDEPDirStr + sID + ".ppt"
Dim p As New System.Diagnostics.Process
'p.Start(MDEPDirStr & "macrun.exe", sPPTOut)
p.Start("C:\WINDOWS\SYSTEM32\CALC.EXE")
'p.Start("C:\WINDOWS\SYSTEM32\macrun.exe", sPPTOut)
|
by: tshad |
last post by:
This has been driving me crazy.
I have been trying to get the error handling working on my system and can
get parts of it working and others won't work at all.
I found that you can't access session variables from Application_Error
event, but I need to so I don't need to set up traces to see what they are
during an error. I am emailing the error condition to myself when it
happens.
|
by: JDS |
last post by:
I am getting the following error in my application:
System.UnauthorizedAccessException was unhandled
Message="Access to the port is denied."
Source="System"
StackTrace:
at System.IO.Ports.InternalResources.WinIOError(Int32
errorCode, String str)
at System.IO.Ports.SerialStream.Dispose(Boolean disposing)
at System.IO.Ports.SerialStream.Finalize()
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |