Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi every body sup??!
i have database with sql 2008
i wanna create a strode procedure or everything you think is better for
backup from my database
and save that in other drives
how can i do this??
Posted

Hi,

Include the below 2 scripts in your stored procedure and it will do the trick..it will take a backup and will restore it too.

SQL
BACKUP DATABASE [ReportServer] TO  DISK = N'H:\Backup\ReportServer.bak' WITH NOFORMAT, NOINIT,  NAME = N'ReportServer-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
GO


RESTORE DATABASE [ReportServer] FROM  DISK = N'H:\Backup\ReportServer.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
GO


Happy Coding..

regards
anurag
 
Share this answer
 
v2
Comments
rpm3d 13-Feb-13 4:08am    
thank you
Anurag Sinha V 13-Feb-13 4:12am    
np..happy coding.. :)

-anurag
1. First write all your procedures in your database.
2. Take a backup.
3. Restore the backup in your database server.

Pictorial description you can find from the below link:

http://kb.eukhost.com/backup-and-restore-ms-sql-server-2008-database/[^]

- Arindam
 
Share this answer
 
Comments
rpm3d 13-Feb-13 4:07am    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900