January 7, 2005 at 1:52 am
I need to populate a table with historic data from 1 access table. easy! I then need to append current data, again easy. Probably having a brain fart but I then need to leave this data alone and only populate with new data. Problem the historical and the current id ranges will be unique but different ranges how can I do this.
January 7, 2005 at 11:35 am
I am having some difficulty understanding your question. I think you want the brand new data to have an id range similar to the new data, (as opposed to the historic data). If that is the case, (and your id is an integer), a simple SET IDENTITY_INSERT TableName ON.
CREATE TABLE #Test( RowID int IDENTITY(1,1),
TextField varchar(25))
SET IDENTITY_INSERT #Test ON
INSERT INTO #Test( RowID, TextField) SELECT 1, 'Historic 1'
INSERT INTO #Test( RowID, TextField) SELECT 2, 'Historic 2'
INSERT INTO #Test( RowID, TextField) SELECT 3, 'Historic 3'
INSERT INTO #Test( RowID, TextField) SELECT 4, 'Historic 4'
INSERT INTO #Test( RowID, TextField) SELECT 5, 'Historic 5'
INSERT INTO #Test( RowID, TextField) SELECT 1001, 'New 1001'
INSERT INTO #Test( RowID, TextField) SELECT 1002, 'New 1002'
INSERT INTO #Test( RowID, TextField) SELECT 1003, 'New 1003'
INSERT INTO #Test( RowID, TextField) SELECT 1004, 'New 1004'
INSERT INTO #Test( RowID, TextField) SELECT 1005, 'New 1005'
SET IDENTITY_INSERT #Test OFF
INSERT INTO #Test SELECT 'Brand New 1006'
INSERT INTO #Test SELECT 'Brand New 1007'
INSERT INTO #Test SELECT 'Brand New 1008'
INSERT INTO #Test SELECT 'Brand New 1009'
INSERT INTO #Test SELECT 'Brand New 1010'
SELECT * FROM #Test
DROP TABLE #Test
I wasn't born stupid - I had to study.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy