September 19, 2011 at 8:21 am
I am doing BCP out in using BCP out utility and calling this from .CMD in following way.
--------------------BCP OUT START------------
bcp "exec %SERVER%.dbo.Pull_Voucher_Data" queryout C:\Vouchers.txt -t\t -c -S%Server1% -b2000 -T
IF ERRORLEVEL 1 (
echo *** Execution Failed ***
set RetCC=1
goto end
)
--------------------BCP OUT COMPLETED------------
If the underline BCP out stored procedure thrown an error & returned 1 (1 means failed).The cmd does not handled this error, it shows successful execution.
Note -
1. In stored procedure I have also use RaiseError function to throw an error.
2. Stored procedure return the error raised by RaiseError
3. BCP utility does not recognized that the underline BCP out stored procedure failed.
4. BCP statements get completed with message zero records copied.
Can you pls help me out to catch this error in cmd file.
February 28, 2012 at 5:06 am
Hi,
I have exactly the same issue - is anyone able to assist?
Basically i am using the queryout option to execute a stored proc that ultimately returns rows to be bcp'd, but first performs some operations on the data. If the operations fail, the BCP command still reports success. I have set the max allowable errors to be zero (-m0) but still it reports success.
Any help would be much appreciated.
Thanks
Guy
February 28, 2012 at 8:18 am
I did some research and find out that its existing bug with BCP utility.
Regards,
Tanmay Shende
February 28, 2012 at 10:30 am
Have you tried outputting the error to a text file? i.e. /ee:logfile.txt
Try something like this:
bcp "exec %SERVER%.dbo.Pull_Voucher_Data" queryout C:\Vouchers.txt /ee:logfile.txt
-t\t -c -S%Server1% -b2000 -T
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply