Red Gate forums :: View topic - Data type conversion
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

Data type conversion

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
bryantb2



Joined: 01 Nov 2011
Posts: 2

PostPosted: Tue Nov 01, 2011 9:31 pm    Post subject: Data type conversion Reply with quote

I have manually mapped 2 databases as follows:

Quote:
tableMapping.FieldMappings.Add(new FieldMapping(tableMapping.Obj1.Fields["pa_firstname"], tableMapping.Obj2.Fields["FirstName"], FieldMappingStatus.Success));
tableMapping.FieldMappings.Add(new FieldMapping(tableMapping.Obj1.Fields["pa_lastname"], tableMapping.Obj2.Fields["LastName"], FieldMappingStatus.Success));
tableMapping.MatchingMappings.Add(new FieldMapping(tableMapping.Obj1.Fields["pa_id"], tableMapping.Obj2.Fields["SurrogateKey"], FieldMappingStatus.Success));

My problem is that when I call CompareDatabases I receive the following error:

Quote:
RedGate.SQLCompare.Engine.SqlCompareException was unhandled
Message=Unable to compare between fields pa_id and SurrogateKey, types being compared System.Int64 and System.String.
Source=RedGate.SQLDataCompare.Engine


Is it possible to compare a field, in this case "pa_id", as a varchar type rather than its native type?
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 589

PostPosted: Thu Nov 03, 2011 1:26 pm    Post subject: Reply with quote

The thing to do here would be to cast into a view and then perform the comparison
Back to top
View user's profile Send private message
bryantb2



Joined: 01 Nov 2011
Posts: 2

PostPosted: Thu Nov 03, 2011 3:01 pm    Post subject: Reply with quote

That's what we were doing as an interim solution. It would be nice if widening conversions could be handled somehow without the use of a view though.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group