Command-line error when passing arguments as a variable

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Command-line error when passing arguments as a variable

Postby tslagter » Tue Sep 18, 2012 6:54 pm

There appears to be a bug when building the command line argument list dynamically using variables. If an extra space is included at the beginning of a variable, the command fails.

For example, this works fine:
Code: Select all
set db1=\"/db1:database1\"
set db2=\"/db2:database2\"
sqlcompare.exe /s1:server1 /s2:server2 %db1% %db2%


The following fails (note the space in db1):
Code: Select all
set db1=\" /db1:database1\"
set db2=\"/db2:database2\"
sqlcompare.exe /s1:server1 /s2:server2 %db1% %db2%

This returns: \"Error: Invalid command-line argument: /database1. ...\"

This error seems to occur for any argument passed as a variable that begins with a space; I originally found this building up a series of \"/exclude\" switches.
tslagter
 
Posts: 3
Joined: Tue Aug 10, 2010 7:26 pm

Postby james.billings » Thu Sep 20, 2012 7:51 pm

Thanks for your post - can I check what version of Compare you're using, as I tried this myself, and it seems to work okay.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby tslagter » Tue Sep 25, 2012 3:39 pm

I'm using version 10.2.0.1337, Professional Edition, on Windows 7, sp1.

This is a new script, so I'm not sure if it would have worked with a previous version.
tslagter
 
Posts: 3
Joined: Tue Aug 10, 2010 7:26 pm

Postby james.billings » Thu Oct 11, 2012 5:24 pm

Sorry for my delay in replying, i've been away for a couple of weeks. I'm currently on 10.2.2.x so it may well be something that's resolved in the update as you're on 10.0
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby tslagter » Thu Oct 11, 2012 6:07 pm

I just updated SQL Compare to version 10.2.3.1, ran the code above in the command line, and got the same error.

And, BTW, there doesn't seem to be any indication of a new version beyond 10.2.0.1337 - that's the latest post I see.
tslagter
 
Posts: 3
Joined: Tue Aug 10, 2010 7:26 pm

Postby james.billings » Thu Oct 11, 2012 6:32 pm

It may well be I'm on an earlier test version then - I'll check with the Compare team.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Compare 10

Who is online

Users browsing this forum: No registered users and 2 guests