您的位置:首页 > 数据库

SQL Server知识总结及常用命令

2012-08-09 17:51 253 查看
1、获得表或者数据库的ddl

有的时候想把某个表的ddl导出,方法如下:选中表,点击右键,选择“Script Table as”-》“Create To”,选中文件或者剪贴板,当然还有一些别的选项。

如果想把一个数据库里的表都导出,有一个便利的方法:

Right-click on the Database, select
Tasks
and
then
Generate
Scripts
, which will launch the Script Wizard. This allows you to generate a single script that can recreate the full database including table/indexes & constraints/stored procedures/functions/users/etc. There are a multitude of options that you can
configure to customise the output, but most of it is self explanatory.

If you are happy with the default options, you can do the whole job in a matter of seconds.

If you want to recreate the data in the database (as a series of INSERTS) I'd also recommend SSMS
Tools Pack (Free).
http://stackoverflow.com/questions/5771047/create-sql-script-that-create-database-and-tables
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: