Moja Ra Moja Ra - 3 months ago 11
SQL Question

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

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

Answer

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

.sql files are typically run using Sql Management Studio. They are basically saved SQL statements, so could be anything. You dont "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 an SQL file against your database unless you know what it is doing. SQL scripts can be as dangerous as unchecked exe's