Use this script to generate BACKUP DATABASE scripts for selective or all databases during Instance or Database migration.
Query result generated from above dynamic script will produce same result as Backup taken from backup job.
Execute the script on source Instance. At the top, under multi line comment, one can see text like "Total Inputs: ",
/* Created By: AJAY DWIVEDI
Created Date: NOV 25, 2014
Purpose: Script out Take Backups
Total Inputs: 3
*/
This hints that user input is required at 3 points within scripts. One can find input lines by looking for pattern like
--1) specify database backup directory
--2) Specify (True=1) or (False=0) for COPY_ONLY backup option
--3) Specify your DB names for backup in case of data migration