I have a .sql file and I am trying to import it into SQL Server 2008. What is the proper way to do this?
Advertisement
Answer
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