bcp return status

bcp return status

Post by Mika » Tue, 13 Feb 2001 17:08:28



Hi,
I 'd like to know, how can I know if bcp has succeeded or not in stored
procedure.
I have case like this:




sa /P pw '




 PRINT "OK"
ELSE
 PRINT "Fail"

and results...

(1 row(s) affected)

output                                                                      

                            --------------
DB-LIBRARY error:
 Bcp: Unable to open host data-file.

(2 row(s) affected)

-----------
1

(1 row(s) affected)

OK

So, why result is 1 while bcp couldn't find file?

I hope someone could help on this...

-Mika-

 
 
 

1. BCP returns status = nothing

|> We are running Sybase 4.9.2 on VAX/VMS 5.5-2 and there is
|> no apparent way to "trap" errors - it will output an error
|> message but there seems to be no way to redirect error
|> output to a file through "ON ERROR XXX ".
|>
|> This is frustrating because many batched jobs use BCP and
|> the error messages can scroll by without being noted, and
|> since VMS doesn't see the error status returned no corrective
|> action can be applied...

Have you invoked bcp with the "-e" (/error= on VMS) parameter.
this will create a bcp error file if any errors are encountered.

If you are already doing that, but the output isn't enough or you want
to capture operating system errors as well as bcp errors, then you
could capture the entire bcp session into a log file.  If I remember
my VMS right, you can either redefine SYS$ERROR with a DEFINE/ASSIGN
statement.  Or you can do SET HOST 0/LOG=filename and this will
absolutely capture all screen output to the log file for the SET HOST
command.  

                                Hope this helps
                                Teresa Larson

+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
| Teresa A. Larson - Hughes STX Corporation                            |
| NASA/GSFC Code 933.0                        voice:  (301) 286-7867   |
| Greenbelt, Maryland  20771                  fax:    (301) 286-1777   |

+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
                        Standard disclaimer ...

2. US-CA-ORACLE PROCURE TO PAY PROJECT MANAGER

3. BCP Return Status

4. Help using Pro*C as CGI

5. Resume: Sybase/PB Certified avail for CONTRACT in Texas

6. BCP and inconsistent return status

7. Cellset performance ?

8. xp_cmdshell return status from BCP in/out operation

9. Any return status for bcp ??

10. stored procedures: return codes and return status with rdo

11. status codes from isql and bcp

12. Data provider or other service returned an E_FAIL Status