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

database recovery of SQL using VB

hi..
my prob is..... i want to make a utility that can recover the database structure and that default data using visual basic and sql server 7 ...i m not so familiar with ms-sql....so i need some help from ur side...
if u think...u can help me...then plz give me the description...and ask me if u have some doubt regarding the que...
and ya if u can give me some logic abt this que and data-back-up utility...then it'll be better..for me

thanks
bye bye
me...
0
memyselfandvb
Asked:
memyselfandvb
1 Solution
 
TravisHallCommented:
Well, there's no way you could ever recover the database structure without recording what that structure is in the first place, so your utility would have to do that. However, if you are even contemplating this, you must have SQL Server 7 already, and SQL Server 7 has what basically amounts to a built-in utility to do this.

To use this, open the SQL Server Enterprise Manager (management tool installed with SQL Server, basically). Select your database on the left - it's under Console Root -> Microsoft SQL Servers -> [whatever your server group is - probably SQL Server Group] -> <your server name> -> Databases. Check that Taskpad is selected under the View menu. In the right pane, make sure that General is selected at the top. Then click on "generate SQL scripts", under Database on the right.

A spiffy dialog will pop up and ask what you want to script. Just check the "Script All Objects" box to get the entire database. You probably also want to check out the Options tab, to make sure you script triggers and security objects and such. Then just click OK and tell it where to save your script, and it'll do it for you.

What you end up with is an SQL script which will build your entire database structure from scratch. You just need to create the database itself (not anything in it, like tables and such), open the script in Query Analyzer (look in the same place you find Enterprise Manager), and hit the green-arrow go button, and it'll build the whole thing for you.

OTOH, if you want to have some data stored in the tables to start with, this won't work. It just gives the database structure, and I'm not sure if what you mean by "default data" is some starting data in the database. If this is what you want, you should simply make a backup of your database in its original form. Then, to set it up on a different server, just restore from that backup. With SQL Server, you don't have to restore to the same server that to backup came from, and you can create extra copies of a database this way.

If you are working with SQL Server in any serious capacity, you should learn about SQL Server backups. There's far more to it than I can give you here, but it's pretty straightforward. Check it out in SQL Server Books Online.

None of this uses VB, of course, by why use VB when the utilities to do the job come ready-made with MSSQLServer7?
0
 
DanRollinsCommented:
Hi memyselfandvb,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept TravisHall's comment(s) as an answer.

memyselfandvb, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 
NetminderCommented:
Per recommendation, force-accepted.

Netminder
CS Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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