Training using the latest Microsoft SQL Server AdventureWorks database and need the latest database diagram?
As of when this article is written, the latest AdventureWorks database is AdventureWorks2017, found here.
So here you go. Image above is showing the latest AdventureWorks2017 database diagram, however FYI, the database diagram shown above doesn’t have complete set of AdventureWorks tables – I just select what I needed.
But don’t worry, in case the diagram isn’t sufficient for your work, here I’ll show you how to generate the database diagram yourself. And the good thing is that, this steps is regardless of which version of the AdventureWorks is and also can be used to generate database diagram for other databases as well.
Generate Latest AdventureWorks Database Diagram (works too for any databases)
1) Ensure you have SQL Server up database and running, ensure too you have the SQL Server Management Studio (SSMS).
3) Open SSMS then open and expand the AdventureWorks database (or any other database you want to generate the database diagram).
4) On the expanded database view, go to Database Diagrams, do right click then choose “New Database Diagram”.
5) When prompted, “This database does not have one or more support objects required to use database diagramming. Do you wish to create them?”, click “Yes”.
6) Select the tables you want to see the relationship among them and and show as database diagram. Do click on “Add” on the tables you need. My recommendation here is to just select tables that you need. Selecting all the tables altogether will cause the database diagram to appear tangled and complicated. Click “Close” once done.
7) Database diagram shall be created and the linkages between the tables (if they are connected one to another) will also shown.
8) If needed to arrange the tables, do right click on the empty space, and choose “Arrange Tables”. If the auto-arrangement is not good enough for you, you can arrange yourself.
That’s it! You can redo step #3 to step #8 above on any database you have on SQL Server.
SQL Server Error: 15517, Principal “dbo” does not exist
When restoring AdventureWorks database (or any other database) then tried creating Database Diagram, you may get this error, “Cannot execute as the database principal because the principal “dbo” does not exist, this type of principal cannot be impersonated, or you do not have permission. (Microsoft SQL Server, Error: 15517)”, typically the error is because the database owner isn’t the same as the user you are using to login to database.
Run the following command to resolve the issue.
use <database_name> EXEC sp_changedbowner ‘<login_id>’
If the database is “AdventureWorks2017” and the login id used is “sa”, this is the command you need to run on SSMS.
use AdventureWorks2017 EXEC sp_changedbowner ‘sa’
For Life, Tech tips, iOS and Android Apps and Games quick review, do visit below:
Hi, thanks for reading my article. Since you are here and if you find this article is good and helping you in anyway, help me to spread the words by sharing this article to your family, friends, acquaintances so the benefits do not just stop at you, they will also get the same goodness and benefit from it.
Live to Share. Share to Live. This blog is my life-long term project, for me to share my experiences and knowledge to the world which hopefully can be fruitful to those who read them and in the end hoping to become my life-long (passive) income.