Solved

database recovery of SQL using VB

Posted on 2001-09-14
3
148 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

12 Experts available now in Live!

Get 1:1 Help Now