المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Accessing the file of a T-SQL BACKUP call



C# Programming
08-02-2009, 08:02 PM
Trying to provide a backup "button" inside the C# Windows Forms application on a client PC that connects to a SQL Server database, I want to grab the resulting backup file of a call to the BACKUP DATABASE (http://technet.microsoft.com/en-us/library/ms186865.aspx)[^ (http://technet.microsoft.com/en-us/library/ms186865.aspx)] T-SQL function.

Since the BACKUP DATABASE function takes a file path that is relative to the SQL Server itself, I see no reliable way to get the resulting backup file from the client.

My ideal way would be:

1.) Call the BACKUP DATABASE function from my client application.
2.) Specify to backup to a local file (or even better: a C#/.NET stream (http://msdn.microsoft.com/en-us/library/system.io.stream.aspx)[^ (http://msdn.microsoft.com/en-us/library/system.io.stream.aspx)]).
3.) Capture the resulting BAK file from my client application.

Question: Is this possible to achieve?

(I will cross-post this message to the Database forum, since I am unsure whether this is more an ADO.NET topic)

Thanks
Uwe

• My personal 24/7 webcam (http://magerquark.com)
• Zeta Test (http://zeta-test.com) - Intuitive, competitive Test Management environment for Test Plans and Test Cases. Download now! (http://bit.ly/7mRxO)
• Zeta Producer Desktop CMS (http://zeta-producer.com) - Intuitive, very easy to use. Download now! (http://bit.ly/SyRGm)