Solved

database recovery of SQL using VB

Posted on 2001-09-14
3
154 Views
Last Modified: 2010-05-02
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
Comment
Question by:memyselfandvb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
TravisHall earned 300 total points
ID: 6489178
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 7208430
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
 
LVL 5

Expert Comment

by:Netminder
ID: 7241244
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

688 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