Export database by a query?

Posted on 2005-04-18
Last Modified: 2010-03-19
Hi experts,
Can i export my database (for backup) from Sql Server 2000 by a query in Query Analyser? If i can, what is the query?
Question by:nthnhung
    LVL 32

    Accepted Solution


    BACKUP DATABASE <Databasenamehere> TO DISK='C:\Backups\MyBackup.Dat'

    There are a lot of options on the BACKUP DATABASE call - you should look them over.
    LVL 1

    Author Comment

    Thank bhess1!
    I did it! But i still confuse if i can export my database into a script file (the same as calling funtion  "Generate SQL Script..." in Sql Server Enterprise Manager) by a query?
    What have to do if i just want to export particular tables instead of complete database or files?
    Thanks again  in the bottom of my hear!
    LVL 30

    Expert Comment

    I'm pretty sure there's no SQL query you can run to create a script of a table.

    You can probably use DMO to do it though
    LVL 8

    Expert Comment

    If you want to script certain tables - use enterprise
    Manager - Generate scripts.

    You will see ALL TAble check box - deselect then
    at the bottom - choose only the tables that you want
    to script.

    LVL 30

    Expert Comment

    Remember when you create a script (by whatever method), you are not exporing data, only an empty table
    LVL 1

    Author Comment

    I have to say thank to all of you!
    I can do my require by using Enterprise Management but the real solution i need: looking for a query. And now, i know that i can't  back up  a complete database into a script file by a query.
    I'll try to use BACKUP DATABASE query for my application.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Viewers will learn how the fundamental information of how to create a table.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now