| Author |
Message |
jijobaby
Joined: 01 Jun 2010 Posts: 3
|
Posted: Tue Jun 01, 2010 2:42 pm Post subject: Table vs View Comparison |
|
|
I am trying to compare Table and view but looks like i am getting no where.
I tried doing it by creating the object of Tablemapping , but then i found out that we cannot mapping it to a view using this object sicne the property called "Status" is giving unsuccessful. Example
tableMapping = (TableMapping)mappings.Join(db1.Tables["[dbo].[" + srcTable + "]"], db2.Views["[dbo].[" + destTable + "]"]);
SO,
i got another object called ViewsAndTables but looks like this one is also throwing some casting error. We are not sure if we can use this object
viewTableMapping = (ViewsAndTables)mappings.Join(db1.Tables["[dbo].[" + srcTable + "]"], db2.Views["[dbo].[" + destTable + "]"]);
Error thrown here is
Error 1 Cannot convert type 'RedGate.SQLCompare.Engine.Mapping<RedGate.SQLCompare.Engine.ViewTableSuperClass>' to 'RedGate.SQLCompare.Engine.ViewsAndTables'
Can anyone help me here? _________________ JIjo Baby |
|
| Back to top |
|
 |
jijobaby
Joined: 01 Jun 2010 Posts: 3
|
Posted: Wed Jun 02, 2010 3:23 pm Post subject: |
|
|
I am using SQL Data Compare for the Table-View Mapping. However if you look at the screenshot you will be able to see that the Status is shown as "unsuccessful". Generally when i do the mapping between the tables then the status is shown as "success"
What can be the reason for the same . Let me know your thoughts _________________ JIjo Baby |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6344 Location: Red Gate Software
|
Posted: Wed Jun 02, 2010 5:50 pm Post subject: |
|
|
Hi,
You are probably trying to join two tables that don't have any matching columns and/or primary keys. In that case you have to construct the mappings manually by adding FieldMappings and MatchingMappings. Please see: http://www.red-gate.com/support/Knowledgebase/SQL_Comparison_SDK/SDK7ColumnMapping.pdf . _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
jijobaby
Joined: 01 Jun 2010 Posts: 3
|
Posted: Thu Jun 03, 2010 10:32 am Post subject: |
|
|
Thanks so much for your mail. After having such informatic conversation i feel that i am closer to the solution.
Here is what i am doing here to construct the mappings manually by adding FieldMappings and MatchingMappings.
tableMapping.MatchingMappings.Clear();
tableMapping.MatchingMappings.Add(tableMapping.FieldMappings["DownloadID"]);
tableMapping.MatchingMappings.Add(tableMapping.FieldMappings["CultureGroupId"]);
tableMapping.RefreshMappingStatus();
session.CompareDatabases(db1, db2, mappings);
TableDifference difference = session.TableDifferences["[dbo].[" + srcTable + "]"];
Here when i try to do a quick watch on the Mappings object i can see that the Status is shown as PartialSuccess. I understand i need to have the status as Success for the difference to come correctly.
Currently its showing some difference which doesnt make any sence.
Is there something that is to be done to get my status as Success?
NOTE : When i do this on tables i get Status = Success
I really appreciate your help here. Thanks a ton _________________ JIjo Baby |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6344 Location: Red Gate Software
|
Posted: Thu Jun 03, 2010 2:27 pm Post subject: |
|
|
MatchingMappings are the comparison key mappings. Don't forget to add all of the other FieldMappings for columns that you aren't using to match rows. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| 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