Red Gate forums :: View topic - Table vs View Comparison
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

Table vs View Comparison

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



Joined: 01 Jun 2010
Posts: 3

PostPosted: Tue Jun 01, 2010 2:42 pm    Post subject: Table vs View Comparison Reply with quote

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
View user's profile Send private message Send e-mail
jijobaby



Joined: 01 Jun 2010
Posts: 3

PostPosted: Wed Jun 02, 2010 3:23 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Brian Donahue



Joined: 23 Aug 2004
Posts: 6678

PostPosted: Wed Jun 02, 2010 5:50 pm    Post subject: Reply with quote

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 .
Back to top
View user's profile Send private message
jijobaby



Joined: 01 Jun 2010
Posts: 3

PostPosted: Thu Jun 03, 2010 10:32 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Brian Donahue



Joined: 23 Aug 2004
Posts: 6678

PostPosted: Thu Jun 03, 2010 2:27 pm    Post subject: Reply with quote

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.
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