madlan on Mon, 25 Mar 2013 16:29:26

Is it possible to backup via SMO to a stream rather than directly to file? (I would like to compress the file before writing.)

Dim Server As Server = New Server(SQLServer)
Dim bak As Backup = New Backup()

bak.Devices.AddDevice(BackupFilePath, DeviceType.File)
bak.Database = DatabaseName
bak.Action = BackupActionType.Database
bak.Initialize = True




Iric Wen on Tue, 26 Mar 2013 09:00:15

Hi madlan,

As per my knowledge, we can only backup database to a file and then compress it to a stream following the below two steps:

1.Backup and Restore SQL Server databases programmatically with SMO:

2.Backup compression and Virtual Device Interface (VDI)

If you have any feedback on our support, please click here.

Iric Wen
TechNet Community Support

madlan on Tue, 26 Mar 2013 09:33:50

Oh well, thanks for replying.