• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

Export database by a query?

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?
0
nthnhung
Asked:
nthnhung
1 Solution
 
Brendt HessSenior DBACommented:
Try

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.
0
 
nthnhungAuthor Commented:
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!
0
 
nmcdermaidCommented:
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
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
JulianvaCommented:
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.

0
 
nmcdermaidCommented:
Remember when you create a script (by whatever method), you are not exporing data, only an empty table
0
 
nthnhungAuthor Commented:
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.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now