sql database back up using a .bat file

I am trying to create a script that will delete an existing back up at a specific location (a)
and Create a back up of the database to the same location (a)

Also trying to achieve the same with restoring the database
DBconvAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Just use the script provided over here:

http://www.mssqltips.com/tip.asp?tip=1174

And do it the reverse way for your Restoration script too.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gothamiteCommented:
incidentally, you can use the SQL extended sp xp_delete_file to delete backup files directly from within SQL.
0
Alpesh PatelAssistant ConsultantCommented:
You can do easily using SSIS packages.
There are some task to maintain SQL Server objects and else more.
0
DrewKjellCommented:
You should look into utilizing SQL Maintenance plans as this is a built in part of the system in SQL 2005+.  

http://msdn.microsoft.com/en-us/library/ms177182.aspx
http://msdn.microsoft.com/en-us/library/ms187658
0
Steve WalesSenior Database AdministratorCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.