SQL - create database and tables in one script

后端 未结 4 1771
太阳男子
太阳男子 2021-01-01 22:13

Sorry if already asked, but I can\'t find anything on this.

I am moving something over from MySQL to SQL Server I want to have a .sql file create a database and tabl

4条回答
  •  别那么骄傲
    2021-01-01 22:58

    Between creating the database and creating the tables you will need a USE statement.

    USE dbname
    

    This way the tables will be created in the correct place, without having to specify the DB name on everything.

    Also, GO and BEGIN...END like everyone else is saying.

提交回复
热议问题