473,372 Members | 924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

Backup restoration / append query

Hi All:

Being a bit of a nube to MSSQL I could use a little advice. This is the
situation.

A client's HDD became full so I backed up, deleted then recreated a blank
database (they said they didn't need the stored data).
They have now deceided that they want the data again.

My plan is to restore the database to a second volume so it can grow as much
as is needed, however, there is now data in the second instance that would
need importing to the restored DB.

I can restore the backed up db with a different name and reconfigure the
software that accesses it but what would be the best method to append the
restored DB with the data in the current instance of said DB? Both DBs are
identical.

TIA

MP

Jul 20 '05 #1
1 3140

"Max Power" <Ma*******@excelence.co.uk> wrote in message
news:bu**********@sparta.btinternet.com...
Hi All:

Being a bit of a nube to MSSQL I could use a little advice. This is the
situation.

A client's HDD became full so I backed up, deleted then recreated a blank
database (they said they didn't need the stored data).
They have now deceided that they want the data again.

My plan is to restore the database to a second volume so it can grow as much as is needed, however, there is now data in the second instance that would
need importing to the restored DB.

I can restore the backed up db with a different name and reconfigure the
software that accesses it but what would be the best method to append the
restored DB with the data in the current instance of said DB? Both DBs are
identical.

TIA

MP


There's no generic way to 'merge' two databases, but as a very general
approach, you can do something like this for each table:

insert into DestinationDB.dbo.Table1 (col1, col2, ...)
select col1, col2, ...
from SourceDB.dbo.Table1 s
where not exists (select * from DestinationDB.dbo.Table1 d
where d.PrimaryKeyColumn = s.PrimaryKeyColumn)

But there are potential issues - foreign keys mean you have to populate the
tables in the correct order (or disable them during load), and if tables are
using IDENTITY columns or other artificial keys, then you might exclude
valid data. You also might be able to exclude tables which hold static data
such as countries and currencies.

Simon
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: xabaras | last post by:
Doubt. Backup of the database. Example: CREATE DATABASE prova; CREATE TABLE `test` (`progressivo` tinyint(3) unsigned NOT NULL auto_increment,`testo` char(50), PRIMARY KEY (`progressivo`))...
2
by: emmexx | last post by:
I want to restore a huge database into my workstation. The size of the backup file is more than 6 GB and I don't have enough space on my HD for both the database and the backup file. So I put the...
2
by: Tommy.Vincent | last post by:
hi how can i create a bak file of single table . And one more doubt ,whether its restoration process will be same as its for usual backup(ie full,transactinal backup).
0
by: Richard | last post by:
hi, I am using SQL SERVER 2000. My query is, Can I restore my 60 transactional log file backup in one sql statement,giving condition where it is suppose to start and end.
1
by: Lan W via DBMonster.com | last post by:
Hi, If we want to replace our current production server with DB2 UDB 8.1 on AIX 5. 3 and use redirected restore for the production databases to be “copied” into our new db2 with server. Which...
2
by: rdemyan via AccessMonster.com | last post by:
For some of my really important tables, I have backup tables in the backend file. The idea is that if a user accidentally screws up data, they can go to a form and restore from the backup table...
3
by: Robertf987 | last post by:
Well, I think I've described what I want to do in the title here. In the database, I have two main tables that contain the main data for the database. One for group expenditures, another for...
1
by: lhemski | last post by:
Guys, im using dB2 Version 9. I perform all the re-configuration of database parameter for incremental backup. I perform initial full backup and after adding some records, i perform incremental delta...
0
by: Now You Know | last post by:
Water Damage Restoration 24 hour open 7 Days Phone 1 877 364 5264 When disaster strikes such as a washing machine overflow, bath overflow, burst pipe, rainwater from balcony etc, water damage...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.