By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

Backup SQL Server Database via Visual Basic Code

100+
P: 114
guys, what is the idea to backup sql server databse via visual basic code. And i also want the code please.
Apr 16 '08 #1
Share this Question
Share on Google+
4 Replies


debasisdas
Expert 5K+
P: 8,127
Do you know how to take backup of SQL Server using Batch file ?
Apr 16 '08 #2

100+
P: 114
Do you know how to take backup of SQL Server using Batch file ?
sorry i must say i havent gone thro' it. if u could explain i would be grateful.
Apr 16 '08 #3

debasisdas
Expert 5K+
P: 8,127
Please find a related discussion here .
Apr 16 '08 #4

debasisdas
Expert 5K+
P: 8,127
First create a batch file called backup.bat (It first deletes the existing
backup file, then make a call for the sql command);

c:
cd\backup
del samincbu.bak
sqlcmd -i c:\backup\backup.sql

Then create the T-SQL commands in the file backup.sql, as indicated in
the batch file;

EXEC sp_addumpdevice 'disk', 'samincbu',
'c:\Backup\samincbu.bak'
BACKUP database saminc TO samincbu
GO


Finally you need to call the batch file from VB using SHELL function.
Apr 16 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.