I need to create a backup table dynamically , each time the SQL job is ran, let say every wed, I need to back up this table to that date as prefix example:
Select * into Person_getdate() ...
from person..
How can I do this every time a SQL job runs so it created new back up with that date attached to it?
Thanks,
Pasi
To create a backup with a date attached to it, you can use the command line or a scripting language to automate the process. Here's an example of how you might do this using the command line on a Linux or Mac system: proptinomanager
#!/bin/bash
# set the date variable
DATE=$(date +"%Y-%m-%d")
# set the backup file name
BACKUP_FILE="backup-$DATE.tar.gz"
# create the backup
tar -czf $BACKUP_FILE /path/to/backup/folder
The above script will create a backup file named "backup-YYYY-MM-DD.tar.gz" in the current directory, where YYYY-MM-DD is the current date. The backup file will contain the contents of the "/path/to/backup/folder" directory.
Take a look at the original post. This is to create an online "Backup Table". External scripts aren't required here. If it were for an actual backup, a bit of dynamic SQL would do the trick and compression can be built in.