473,467 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3142

"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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.