Generate script in SQL Server 2005 with data

喜你入骨 提交于 2019-12-04 07:55:42

Unfortunately the options to script data along with schema didn't seem to appear until SQL Server 2008, so I think you're stuck with third party options.

I had the same problem before, and there seems to be no direct script can be made to take all tables structures with their data.

I came around this situation by doing the following:

  1. Generate a script for database architecture (RightClick on Database > Tasks > Generate Scripts > Select all tables, and script to a file)
  2. Create a backup file for the database (RightClick on Database > Tasks > Backup)

Then, to take your database somewhere else:

  1. Execute the database script file to create tables
  2. Restore the database using [Database Name] > Restore > Database.

This worked just fine for me using SQL Server 2005.

Right click on the database. Then select the Tasks->Generate Scripts See the image here

Then, Select the table or tables which you need insert script to be generated. see the image here

Now Click next and click on Advanced and select "Types of data to script" see the image here

Finally, next, next, you get all your data in insert scripts. Good bye excel!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!