Writing SQL in SSMS vs. Microsoft Visual Studio

  • I am using SSMS to practice SQL.  I have seen several videos on YouTube where people are actually writing their SQL code in Microsoft Visual Studio instead of SSMS.

    1. How is writing SQL code in Visual Studio different that writing it in SSMS?
    2. Why would somebody write their SQL code in Visual Studio instead of SSMS?
    3. If you write in Visual Studio, will the same menu options and toolbars in SSMS be present in Visual Studio?
    4. What are the pros/cons of using Visual Studio in lieu of SSMS?
  • The Visual Studio query editing environment is largely, but not perfectly, the same as writing it in SSMS. The core behaviors are the same. I'd say that people who work primarily within Visual Studio are more likely to stay there to write queries. Where as, if you work primarily within SSMS, you're more likely to stay there. You see more crossover when you start talking about automating deployments and getting your code into source control. There are more tools oriented towards this in Visual Studio than in SSMS.

    The menu choices are absolutely going to be different. The key here is Visual Studio is oriented towards development. SSMS is oriented towards database and server management. They are going to have very different menu choices, etc. Your initial question was focused on query writing. Writing a query is writing a query. They both do that roughly the same.

    As to point four, are you developing code and databases? You may see better use in VS (source control being the biggie here). Are you managing servers and databases as well as developing code and databases? You may see better use in SSMS.

    Also, don't forget about Azure Data Studio. This offers a very different development environment. Again, oriented to development over management.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • +1 to what Grant said. For the most part, pick the one you are comfortable with.

    ADS is really nice as it's quick to start and use. Lacking some things I use, but for a beginner, you might prefer this.

  • One more thing.  if you create a project in SSMS you cannot open it with Visual Studio. And visa-versa.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • Michael L John wrote:

    One more thing.  if you create a project in SSMS you cannot open it with Visual Studio. And visa-versa.

    Depending on tool ;). Redgate has a product that has a database project opens in both VS and SSMS

  • Grant Fritchey wrote:

    The Visual Studio query editing environment is largely, but not perfectly, the same as writing it in SSMS. The core behaviors are the same. I'd say that people who work primarily within Visual Studio are more likely to stay there to write queries. Where as, if you work primarily within SSMS, you're more likely to stay there. You see more crossover when you start talking about automating deployments and getting your code into source control. There are more tools oriented towards this in Visual Studio than in SSMS.

    The menu choices are absolutely going to be different. The key here is Visual Studio is oriented towards development. SSMS is oriented towards database and server management. They are going to have very different menu choices, etc. Your initial question was focused on query writing. Writing a query is writing a query. They both do that roughly the same.

    As to point four, are you developing code and databases? You may see better use in VS (source control being the biggie here). Are you managing servers and databases as well as developing code and databases? You may see better use in SSMS.

    Also, don't forget about Azure Data Studio. This offers a very different development environment. Again, oriented to development over management.

    Grant,

    I am not developing or managing at this point.  I'm just learning all of this for now.  Eventually I would like to use SQL to write custom reports and also to build databases.  I am not interested in management of the database (by this I presume you mean being a database admin such as assigning permissions and restricting use).

  • If you're not working on administrative tasks, then you can do most of the work of development in any of the three environments. The core behaviors are identical. And SQL Server itself literally doesn't care how you run your queries as long as the syntax is correct. You could also look to PowerShell to learn how you can use that in automation for development, etc.. There's also the sqlcmd.exe command line.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply