简体   繁体   中英

SQL Server take database backup with some data only

I am trying to download my SQL Server database (that is more than 40 GB) from production server to my local machine. I need only schema & some of data as downloading 40 GB backup file & restoring is really tough task for me.

I have tried to use generate scripts to obtain schema, this was successful. But for getting data for (suppose approx. first 500 rows) of all tables, I am not sure how I should approach that.

Please let me know is there any other way to achieve this?

I am using Microsoft's SQL Server Version 12.0.xxx.

Thanks

SQL Server Management Studio provides a wizard which enables you to generate scripts not only for metadata (or schema) but also the scripts for data within database. Please refer to Script Data in SQL Server But if your database backup size is very big, the script file will be very huge. Actually this wizard does not provide a parameter to script only for first 500 rows of each table.

Besides all, if you have foreign keys and constraints on your table definitions, you might not be enough to get only the first 500 rows. You need every referenced lookup data in your database in order to insert data into your transactional tables, or you need the parent for the child data.

This forces you to create a more smart script for data extraction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM