include parameter doesn't handle spaces

Compares and synchronizes SQL Server databases, backups and scripts.

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

include parameter doesn't handle spaces

Postby philcart » Mon Oct 15, 2012 1:16 am

Using SQL Compare command line

I'm using a Powershell script to build up a SQL Compare command line that generates a deployment script for database changes.

One of our developers created an object with a space in the name which has now been changed. SQL Compare treats this as a drop and create.

The command line that is built has the following arguments,
Code: Select all
/Scripts1:"C:\\Local\\Folder" /server2:mySVR1\\SQLR2 /database2:myDB /username2:theUser /password2:thePwd /include:Different /Include:Missing /include:StoredProcedure:[myStored Procedure] /include:StoredProcedure:[MyStoredProcedure] /options:DecryptPost2KEncryptedObjects,IgnoreWhiteSpace,IncludeDependencies,IgnoreUserProperties,IgnoreWithElementOrder,IgnoreDatabaseAndServerName,IgnorePermissions,IgnoreUsersPermissionsAndRoleMemberships,ForceColumnOrder,IgnoreUserProperties,AddDatabaseUseStatement /scriptfile:"C:\\Temp\\theDeployScript.sql" /force /sync

However, this results in the following error,
Code: Select all
Error: parsing "[myStored" - Unterminated [] set.

So it appears that even though the object name is enclosed in [] characters, SQL Compare isn't handling the spaces in the object name.

Posts: 32
Joined: Mon Aug 14, 2006 6:14 am

Postby Chris Auckland » Wed Oct 17, 2012 12:34 pm

Thanks for your post.

I've tested this out and can see what you mean. I think it happens because the square brackets are special characters and need escaping. I tried adding the escape characters, and that seemed to fix it for me. Can you try:

Code: Select all
 /include:StoredProcedure:\\[myStored Procedure\\] /include:StoredProcedure:\\[MyStoredProcedure\\]
Chris Auckland
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.

Return to SQL Compare 10

Who is online

Users browsing this forum: No registered users and 1 guest