SQL Backup 5   

File Location Tags

See Also

SQL Backup enables you to set up file locations that are automatically generated when the backup is created, by using tags. For example, you can use tags to include the date and time of creation of a backup in its file name:

C:\Backups\<DATETIME yyyymmdd_hhnnss>_Backup.sqb

Tags are particularly useful when you are backing up multiple databases in one operation. For example, you could specify that the backup files for each database are to be created in a separate folder using the <DATABASE> tag in the path:

C:\Backups\<DATABASE>\Backup.sqb

You can use the following tags in path and file names:

<TYPE>

The backup type. SQL Backup will use the following values:

  • FULL for full backups
  • DIFF for differential backups
  • LOG for transaction log backups

<SERVER>

The SQL Server name.

<INSTANCE>

The SQL Server instance name.

<DATABASE>

The database name.

<DATETIME x>

The date and time value of the backup process, where x is a format string. The values that you can use in the format string are listed in Date and time format. Note that you can use only one DATETIME tag in the default name.

<AUTO>

If you specify <AUTO>, SQL Backup uses the backup file location options to generate the backup file path and file name. If no backup location options have been set up, SQL Backup uses the SQL Server instance's default backup folder, and the default format for file names. For details, see File Management Options.

If you specify a path and <AUTO> (for example C:\MyBackups\<AUTO>), SQL Backup uses the specified path, and generates the file name using the Backup Location options. If no backup location options have been set up, SQL Backup uses the default format for file names.

If you specify <AUTO> with a file extension (for example <AUTO>.sqb, SQL Backup uses the Backup Location options to generate the backup file path and file name. If no backup settings have been set up, SQL Backup uses the SQL Server instance's default backup folder, and the default format for file names. This is useful when you generate split backup files.

Date and time format

You can use the following formats for string x in the <DATETIME x> tag.

d

Displays the day as a number without a leading zero (1-31).

dd

Displays the day as a number with a leading zero (01-31).

ddd

Displays the day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable.

dddd

Displays the day as a full name (Sunday-Saturday) using the strings given by the LongDayNames global variable.

ddddd

Displays the date using the format given by the ShortDateFormat global variable.

dddddd

Displays the date using the format given by the LongDateFormat global variable.

m

Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.

mm

Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.

mmm

Displays the month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.

mmmm

Displays the month as a full name (January-December) using the strings given by the LongMonthNames global variable.

YY

Displays the year as a two-digit number (00-99).

YYYY

Displays the year as a four-digit number (0000-9999).

h

Displays the hour without a leading zero (0-23).

hh

Displays the hour with a leading zero (00-23).

n

Displays the minute without a leading zero (0-59).

nn

Displays the minute with a leading zero (00-59).

s

Displays the second without a leading zero (0-59).

ss

Displays the second with a leading zero (00-59).

 

 

 


© Red Gate Software Ltd 2007. All Rights Reserved.