Solved

database recovery of SQL using VB

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

862 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

21 Experts available now in Live!

Get 1:1 Help Now