SQLAzureMWBatchUpload hangs on error and does not return to prompt

May 29, 2013 at 9:50 AM
Here is how I generate the error. I did it on purpose but still wondering why when SQLAzureMWBatchUpload runs into an error, it does not return to command prompt?
Is it by design?

Steps to get SQLAzureMWBatchUpload to hang.
  1. Run SQLAzureMW.exe
  2. Select Database, click Next
  3. Select any Database with tables that contain a key.
  4. select schema and tables
  5. Select 3 tables to create output for
    After it creates the scripts, save the sql as Test.sql
    now run
    sqlazuremwbatchupload -d false -o c:\temp\errorTest.txt -i C:\SQLAzureMW\test.sql
The first time it runs, it should work because the tables are empty
now run the command again and obviously it will error because you can't insert key values twice.

In the command prompt, if it errors, it would show the following error

5/29/2013 2:31:43 AM--> Error

Starting copy...
SQLState = 23000, NativeError = 2627
Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of PRIMA
RY KEY constraint 'PK_CBAccountType'. Cannot insert duplicate key in object 'Sec
ured.CBAccountType'. The duplicate key value is (0).
SQLState = 01000, NativeError = 3621
Warning = [Microsoft][SQL Server Native Client 11.0][SQL Server]The statement ha
s been terminated.
BCP copy in failed

But it does not return to the command prompt >

How come it does not return to the command prompt? and is this by design?

I am asking because if I create a batch file with multiple sqlazuremwbatchupload in the file
if one fails, it will cause the others lines not to execute.
May 29, 2013 at 5:20 PM

Great feedback. I went through your example and was able to reproduce the issue. I found the problem and need to do a some regression testing. Hopefully, I will get a new version posted today.

Thanks for your time!
May 29, 2013 at 8:03 PM

Since the change only effected SQLAzureMWBatchUpload, I just made a minor update. Download SQLAureMWBatchUpload v3.9.12.1 or v4.0.15.1 and let me know if that works for you.

Thanks again,
May 29, 2013 at 10:43 PM
Thank you George for the great turn-around time. I will check it out now.

May 29, 2013 at 10:53 PM
Thanks George,

The updated does resolve the issue.

Will you be making the updated source code available for download anytime soon?

We use a modified version of your tool.

May 30, 2013 at 2:09 PM
Hi Mark,

I will see if I can't get it uploaded today. But for now, you can edit BCPJobProcessHandler.cs and change line 60 to this:
            if (BCPJobs[index].JobStatus == CommandStatus.InProcess || BCPJobs[index].JobStatus == CommandStatus.Waiting)
That was the fix.

Let me know if you have any questions.