I have a .sql script and I want to build a database from it. How to do it in sqlcmd? I know it’s like:
CREATE DATABASE dbName
GO
But how to specify the .sql script and location to build the database?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use @Jeremiah Peschka’s answer to supply the
sqlcmdutility with the script to execute.As for the location for the newly created database, it can be specified as part of the
CREATE DATABASEcommand:As you can see from the linked article, you can specify other properties as well, like initial size, maximum size etc.