posted 2/26/2010 9:57:11 AM by MikeDavis
When creating report models you might run into bad database designs where the tables have no foreign keys and/or no primary keys. This can be resolved in the report model DSV. I have created two tables, one with first names, the second with last names. Each has an ID column which is the row that matches the row on the opposite table. There are no primary keys and no foreign keys on either table.
In visual studio I created a report model project and selected the database with these two tables. Then I created a DSV with these two tables.
After you create the DSV (Data Source View), right click on the DSV and select open.You will see the two tables in the DSV view.
Then I right clicked on the row to set a primary key. Remember this row must be unique.
Then I dragged the first ID to the second ID to create the foreign key. Remember, these must be matching data types.
Then I create the model and it has the relationships needed to create reports.
I created a report in report builder 2.0, here you can see how the names match up correctly.
MikeDavis (Member since: 10/27/2009 8:52:44 AM) Mike Davis, MCTS, MCITP, Senior Business Intelligence Consultant at Pragmatic Works. He is an author on two Business Intelligence books. Mike is an experienced speaker and has presented at many events such as several SQL Server User Groups across the US, Code Camps, SQL Server Launches, and SQL Saturday events. Mike is an active member at his local user group (JSSUG) in Jacksonville, FL.
View MikeDavis 's profile
Leave a comment
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address: