SQL Data Tools In C# – Database Creation, Management, and Deployment in Visual Studio


Full courses:
Source Code:
Newsletter signup:

What if I told you that you could create a SQL Database in Visual Studio, manage it like any other project, track it with source control, deploy it to multiple environment, and refactor it like C# code? In this video, I am going to show you how to do all of those tasks and more. The best part is that it is free and comes baked into Visual Studio. And no, we aren’t going to be using Entity Framework, although this method is compatible with Entity Framework.



  1. Of all the videos of yours I've watched I've never seen you connect to Oracle. SQLServer, yes. SQlite, yes. MySql, yes. But no Oracle?? Why not?

  2. Tim, if I understood correctly I can't put data in my database project. I want to put some dummy data inside, so when my project gets downloaded data is already there. It seems to me that I can only put data after I already published my database project to a local server. Is that correct? It is probably very stupid question but I'm new to this.

  3. Dear Tim,
    This is very excellent tutorial.
    I am developing an intranet project the server is in my client location, and the development in my machine.

    update the database in production server?
    Thank you very much indeed.

  4. 감사합니다. 선생님의 강좌는 늘 유익하고 많은 도움이 됩니다. 항상 일상에 행운과 기쁨이 함께 하시길 ..

  5. Hi Tim, another good video from you! That is really cool feature to manage database scheme, will include in my current project) thanks!

  6. Thank you Tim for video, just question: if I have user in security options of my db, how to add it automatically in publishment of my c# project?

  7. Hello Tim is the Post Publish Script the only way to alter a Table after it has been created and already has data stored in it? I'm trying to add a column I forgot about but I can no longer publish. I just went ahead and deleted the table and created it again because I only had 2 rows, but in the future when there is significant data stored that wouldn't be a good idea.

  8. another beginner question: You use the term scripts @ 16:39 while hoovering over the properties window. Also you are renaming a lot of files, hard to keep up.
    I have been trying to connect two tables (primary/ foreign key) but the Red exclamation point say My data cannot be saved. Any suggestions.

  9. Thanks for this, Tim. I got a question. At 10:26 you're linking an address to a person. This would mean that one person could be linked to several different addresses, right?

    Wouldn't it make more sense to do it the other way around by having an AddressId in the Person table, allowing several people to be listed under one address?

    Maybe I'm confused and got this flipped, or maybe it just depends on what you want the database to do.

  10. Hi Mr Corey.
    This tutorial was amazing and helped me alot i had a serious problem in working with team on DB and now i learned how to do it.

    But there I came up with a question: How to make installation from this db and install (deploy) DB on customer pc?

    Thanks alot for your great courses.

  11. Thanks so much, leveling up on VS2019 SQL tools. Especially useful was the schema comparison between the deployed DB and the project code.

  12. Great content. Thanks. This is a very nice way of saving our Database schema and deploy to different instances, and versions of databases. I noticed when I created a post deployment script, the id of Demo User was 1002 instead of the next available int which was 4. I am not sure what I did wrong. I am concerned about it since the max rows value is set to 1000.

  13. Great video. Great tool.

    You mentioned that you can move your database from a development environment through production. This leads me to a question that’s plagued me for a while. My web.config contains my connection strings. I generally create a variable called environment in my web.config with a different value per environment (i.e Development, mirror, production…) so that I can point to the correct connection string. There have been times when someone accidentally released a new version of my web.config from development to production without changing the environment variable. You can imagine the chaos this created with all database activity pointing to development instead of production. I can’t think of a better way to handle this. Your mention of using this tool to migrate the database made me think there must be a better way. Any suggestions?


  14. Good day Sir…Can I ask you a question? cause i am facing some kind of error like this ( Procedure: [dbo].[CRUD] has an unresolved reference to object [dbo].[Agents].[Id] ) on create stored procedure.. I used VS 2017. I follow all the step in your video..

  15. He tim i very need you on this one . could please explain to me what's the difference between sql server and sql server management system i'm looking on internet for almost 3 hours and i didn't find my answer.

  16. Hello, at 46:31 you say that if we rename the name of added person, it will affect the PostDeployPerson script as well. I tried this and it didn't work. I renamed the added person in table, and after that I pressed "publish" and this added the previous person again. Is there any special way to rename the added person, so it would affect the PostDeploy script?

  17. Hi Tim, under dbo.Person when refactoring its PersonID, I notice from the View FullPerson.sql, does this will not affect:
    select [p].[Id] AS PersonID, [p].[FirstName], [p].[LastName],

    After refactoing from ID to PersonID
    select [p].[PersonId] AS PersonID, [p].[FirstName], [p].[LastName],

    i was hoping the intellisense drop the "as PersonID", since you already execute refactoring process.

  18. I followed your video, but when i create the database, it goes into my localdb databases, but on its own folder like you have named SQLProject at minute 6:00. And When I add a new table at 7:00, it doesn't create a file in Solution Explorer, and therefore I don't know how to create a folder and drag this table in… Can you help?


Please enter your comment!
Please enter your name here