How to ignore leading spaces

Compares and synchronizes SQL database content.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, Michelle Taylor, chengvoon.tong

How to ignore leading spaces

Postby vlady » Thu May 01, 2014 3:41 pm

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?
vlady
 
Posts: 2
Joined: Thu May 01, 2014 3:36 pm

Postby Manfred.Castro » Thu May 01, 2014 5:38 pm

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
Manfred.Castro
 
Posts: 209
Joined: Mon Apr 23, 2012 2:49 pm

Postby David Atkinson » Thu May 01, 2014 10:51 pm

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
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby vlady » Tue May 13, 2014 12:52 pm

Thanks I was able to compare by creating view that included LTRIM()
vlady
 
Posts: 2
Joined: Thu May 01, 2014 3:36 pm


Return to SQL Data Compare 10

Who is online

Users browsing this forum: No registered users and 1 guest