GenerateBackupSQL Method

SQLServer.Database Object

Description

Generates a series of Transact-SQL statements (script) that can be used to backup this database. Set the properties of a created Backup object as desired and pass it to the GenerateBackupSQL method.

Visual Basic

strScript = Database.GenerateBackupSQL ( [DumpSpec :=] Backup )

C++

HRESULT pDatabase->GenerateBackupSQL (
LPSQLOLEBACKUP
pBackup,
SQLOLE_LPBSTR
pstrScript );

Elements

Element Type Description

strScript String Generated Transact-SQL backup script
Backup Backup Created Backup object that specifies how to execute the database backup

Remarks

To schedule this backup script, set the Task.Command property to the string returned by this method.