What are the challenges you face when working across database platforms? Take the survey
Options

How to ignore leading spaces

vladyvlady Posts: 3
I'm trying to compare tables in different databases. Table in one database has CHAR datatype columns with leading spaces and table in another database has VARCHAR datatype column with leading spaced trimmed before input.

Is it possible to compare these tables while ignoring leading spaces?

If not I was planning to copy tables to same source and manually trim spaces before comparing. Is there better way?

Comments

  • Options
    Is it possible to compare these tables while ignoring leading spaces?

    Unfortunately it is not possible to ignore the leading whitespace in a string.

    There is an option to ignore trailing white space however this will only ignore spaces at the end of the string.
    If you wish you can request the feature to ignore leading whitespace in our uservoice forum.
    http://redgate.uservoice.com/forums/147 ... ta-compare
    These forums are actively monitored by our development team and allow our users to request features and vote on them.
    If a feature receives a significant amount of votes or is deemed to have merit development may include the feature in a future release.

    If not I was planning to copy tables to same source and manually trim spaces before comparing. Is there better way?
    Alternatively you could create a view and use the view in the comparison. Provided you enable the option to "Include views". Then map the view to the table in object mapping.
    http://documentation.red-gate.com/displ ... ct+options

    Manfred
    Manfred Castro
    Product Support
    Red Gate Software
  • Options
    David AtkinsonDavid Atkinson Posts: 1,451 Rose Gold 2
    Are you able to create a view? If you do this and LTRIM the column in question, you can map the view against the table in the second database in order to run your comparison. Make sure "include views" is enabled in SQL Data Compare mapping behavior options.
    David Atkinson
    Product Manager
    Redgate Software
  • Options
    Thanks I was able to compare by creating view that included LTRIM()
Sign In or Register to comment.