469,081 Members | 1,834 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,081 developers. It's quick & easy.

Will OSQL Produce SQL Backup?

Will osql product an SQL backup? By this I mean a text file with the
transact-sql in it so I can use it to recreate the database elsewhere?
Thank you.

Jul 23 '05 #1
1 1860

<jo*************@yahoo.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Will osql product an SQL backup? By this I mean a text file with the
transact-sql in it so I can use it to recreate the database elsewhere?
Thank you.


No - if you want to generate .sql scripts to recreate a database and its
objects, you need to use Enterprise Manager or Query Analyzer, or write your
own code to use the SQLDMO API. But if you just want to backup the database
to a backup file, so you can restore it later, then yes:

osql -S MyServer -E -Q"backup database MyDB to disk = 'c:\temp\mydb.bak'"

Then copy mydb.bak to the target server and restore it:

osql -S MyServer -E -Q"restore database MyDB from disk = 'c:\temp\mydb.bak'"

You might find these links helpful (I'm guessing you have MSDE since you
want to use osql.exe specifically):

http://support.microsoft.com/default...b;en-us;314546
http://www.aspfaq.com/show.asp?id=2442

Simon
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by second714 | last post: by
24 posts views Thread by LineVoltageHalogen | last post: by
1 post views Thread by Tiago Costa | last post: by
4 posts views Thread by Zeya | last post: by
7 posts views Thread by gopal | last post: by
5 posts views Thread by gopal | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.