I have a SQL Server database with:
database 1 | database 2 |
---|---|
A | A |
B | B |
C | C |
This will be inserted in a new db (database 2 here) for backup reasons. After the insert my database1 will collect new data but also keeps the old data for some days. So the next hour the program runs another insert. I don't want to have ABC stored again in database 2. This time D E needs to be added:
database 1 | database 2 |
---|---|
A | A |
B | B |
C | C |
D | D |
E | E |
This is an example how it not should be:
database 1 | database 2 |
---|---|
A | A |
B | B |
C | C |
D | A |
E | B |
C | |
D | |
E |
What is the best way to do this and also the fastest way ? I'm using SQL database with ADO.NET in C# at the moment.
Using the SQL creator in visual Studio which is connected to a SQL Server Express:
CREATE TABLE [dbo].[MBR]
(
[Id] INT IDENTITY (1, 1) NOT NULL,
[TimeStamp] DATETIME NOT NULL,
[TAG] VARCHAR(80) NOT NULL,
[Value] VARCHAR(45) NOT NULL,
[Description] VARCHAR(128) NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);