Options

synch one single table via commandline

jonathanatviincjonathanatviinc Posts: 3
edited September 6, 2006 11:47AM in SQL Data Compare Previous Versions
I'm using sqldatacompare 5.2 command-line interface

I'm attempting to synch a single table named Users. I am using an index named 'IX_Users_UserName' which is not the primary key, but it is unique. The problem I am running into is that when attempting to synch the 'users' table, there is another table named 'ConsumerSiteUsers'. I can't seem to exclude this table from my comparrisons. (Because it has 'users' in it's table name)

Here is my syntax.
SQLDataCompare.exe /s1 laptop /s2 laptop /db1 Source /db2 Destination /ck:users:IX_Users_UserName /include:Table:\[Users] /exclude:Table:\[ConsumerSiteUsers] /comparisonkeys:users:username /options:d /cols:users:RoleID,DateCreated,DateLastChangedPassword,DateLastLoggedOn,username,userNameIsEmail,FirstName,LastName,PhoneNumber,PhoneExtension,DateLastVerifiedEmail,EmployeeNum,WizardEnable,DateLocked,PasswordHash,Salt,SecretQuestionID,SecretAnswer /v /ignoremissing /ignoreadditional

There are 2 colums in this table that I cannot replicate. Hence why I'm using an index key 'IX_Users_UserName, and specifying 18 of the columns.

Below is the error I receive:
Error: Invalid comparison keys specified for [dbo].[ConsumerSiteUsers]
'IX_Users_UserName'. Only a single key or unique index may be specified.

Since I am using the /ignoremissing and /ignoreadditional I cannot use a project file. I have 125 tables in my DB, so excluding them all (except 'users') isn't a great option either

Any assistance you may offer would be greatly appreciated.

Comments

  • Options
    To expound on my first post, I would be fine with using a project file for the entire synch job. Unfortunately, I only want to update records that match in both databases. Meaning, I do not want to create or delete any records. When synching via the interface, I always have to manually check the box for "Rows that exist in both databases but are different", and uncheck the other two "rows that exist only in SourceDB", "rows that only exist in "rows that exist only in DestinationDB".

    If i could figure out how to save these settings within project , I'd be okay with this option too. I need to launch this synch on a scheduled basis, so finding a way to persist these settings is key.
  • Options
    Hi Jonathan

    I think the problem is due to you using square brackets around the object names. This is because in regular expressions it will act almost like a wildcard, thus including any table with users in the name.

    Can you try without the square brackets and a hat (^) at the beginning to make the table name start with users. You may also try a dollar sign ($) at the end to signify the end.

    Have a look at: http://en.wikipedia.org/wiki/Regular_expression for more information about using regular expressions.

    Regards
    Dan
    Daniel Handley
    Red Gate Software Ltd
This discussion has been closed.