How do I import a sql data file into SQL Server?

后端 未结 7 1829
北海茫月
北海茫月 2020-12-08 03:41

I have a .sql file and I am trying to import it into SQL Server 2008. What is the proper way to do this?

7条回答
  •  青春惊慌失措
    2020-12-08 04:30

    If you are talking about an actual database (an mdf file) you would Attach it

    .sql files are typically run using SQL Server Management Studio. They are basically saved SQL statements, so could be anything. You don't "import" them. More precisely, you "execute" them. Even though the script may indeed insert data.

    Also, to expand on Jamie F's answer, don't run a SQL file against your database unless you know what it is doing. SQL scripts can be as dangerous as unchecked exe's

提交回复
热议问题