How to import .sql file into SQL Server Express

2019-02-03 18:43发布

I have a plain sql file with some SQL INSERT statements.

Is it possible to import it in my local SQL Server Express instance?

5条回答
迷人小祖宗
2楼-- · 2019-02-03 18:53

All you have to do is open Microsoft SQL Server 2008 Management Studio. Then use File -> Open.

Open the file from the proper location and you'll get all the SQL statements there. After that you can execute them.

Hope this helps.

查看更多
乱世女痞
3楼-- · 2019-02-03 18:59

You can open it via Query analyser and run

查看更多
戒情不戒烟
4楼-- · 2019-02-03 18:59

Here is the tool Sql_Server_Script_Executor

enter image description here

You can add single/multiple file/folder and your files will comes up in the list. Click the execute button and done

It contains three transaction modes.
1. Execute scripts within one transaction
2. Execute scripts on separate transaction
3. No transaction
查看更多
Luminary・发光体
5楼-- · 2019-02-03 19:06

You can use Management Studio Express edition. You can download the latest version here - which will work against SQL Express 2005, 2008 and 2008 R2.

If you don't want to install SSMSE then you can use sqlcmd at a command prompt, e.g. something like this (assuming Windows auth and an instance called "SQLEXPRESS"):

sqlcmd -S .\SQLEXPRESS -E -i "C:\path\file.sql"
查看更多
神经病院院长
6楼-- · 2019-02-03 19:06

The easiest way would be simply open the file in the Sql Management Studio and run it. Since the target table is already created, of course.

查看更多
登录 后发表回答