| Author |
Message |
bryantb2
Joined: 01 Nov 2011 Posts: 2
|
Posted: Tue Nov 01, 2011 9:31 pm Post subject: Data type conversion |
|
|
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 |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 443
|
Posted: Thu Nov 03, 2011 1:26 pm Post subject: |
|
|
| The thing to do here would be to cast into a view and then perform the comparison |
|
| Back to top |
|
 |
bryantb2
Joined: 01 Nov 2011 Posts: 2
|
Posted: Thu Nov 03, 2011 3:01 pm Post subject: |
|
|
| 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 |
|
 |
|
|
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