You can use the bcp Utility with the "query" parameter to export selective data.
SQL server 2019 database backup
Hi All,
I need to backup my sql database either as a whole (*.bak) file or as each table as separate .sql scripts.
.bak file can be done as database backup
.sql script for each table was done by generate script options.
The bottleneck which I was facing here was, I need to take back up with limited period, say some 6 months or providing the date duration.
This was done in mysql by mysqldump by adding where condition.
Is there anyway in sql server to achieve this
Please help me to sort out from this.
thanks in advance
2 answers
Sort by: Most helpful
-
-
CathyJi-MSFT 22,306 Reputation points Microsoft Vendor
2021-01-06T02:59:34.713+00:00 Hi @Venkadesh P ,
>I need to take back up with limited period, say some 6 months or providing the date duration. This was done in mysql by mysqldump by adding where condition.
I am not familiar with MySQL, but I search this. Did you want to only backup last 6 month data from MS SQL server database? If I misunderstood, please let me know.
The BACKUP command does not have any such feature as such. Database backup can be taken only for database or File Group/File level .
You want to backup of part of database. Have You placed your 6 months data in separate file group? If so, then we can take backup.
Please also check if the solutions from below similar threads could help you.
How to Backup last 4 months of data from SQL DB
SQL server backup for 3 months only.Best regards,
Cathy
If the response is helpful, please click "Accept Answer" and upvote it, thank you.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.