Search code examples
sqlsql-serverdatabasesqlcmddatabase-server

How to create a new database in MS SQL Server?


Sorry, if this has been asked previously. In services on a client, I can see that MS SQL Server has the status "started". and on this machine I don't have Microsoft SQL SERVER Management Studio.

How can I create a new database?

Thank you!


Solution

  • Please use sqlcmd utility and then create script to be executed.

    To execute script: sqlcmd -i C:\create_script.sql

    Db create scritp example:

    CREATE DATABASE testDb
    GO
    

    More about the db create options: https://msdn.microsoft.com/en-us/library/ms176061.aspx