Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Appending new data to old data

Author  Topic 

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-05-15 : 08:44:08
Hi Guy,

I have a list of about 20,000 (stored in a table called March2008) people taken from a survey in March and I did the survey for April and I got an additional 12,000 people. I would like to append these 12,000 ppl to the 20,000 ppl. I know you cnan use a Union but then I would have to create multiple tables each time I do the union. Is there any way that I can update the March2008 table with the additional 12,000.

Thanks in advance

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-05-15 : 08:48:34
Yes, by using normal INSERT statement.

If you want more precise answer, please post your table structure, sample data and scenario in more detail.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

cat_jesus
Aged Yak Warrior

547 Posts

Posted - 2008-05-15 : 13:42:25
If you are using separate tables in the first place and you want to see them as a single table or view.... perhaps you should create a view.

something like this

Create view All_everything as
(
select * from March2008
union all
select * from April2008
)


Of course it's likely that all the data should be kept together in one table and you should have a date column but based on the limited information you've provided it's difficult for anyone to give you good advice.


PS.I'm not your guy, buddy!

An infinite universe is the ultimate cartesian product.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-15 : 13:51:02
quote:
Originally posted by velvettiger

Hi Guy,

I have a list of about 20,000 (stored in a table called March2008) people taken from a survey in March and I did the survey for April and I got an additional 12,000 people. I would like to append these 12,000 ppl to the 20,000 ppl. I know you cnan use a Union but then I would have to create multiple tables each time I do the union. Is there any way that I can update the March2008 table with the additional 12,000.

Thanks in advance


Is there a chance that people who participated in March would again participate next month? If yes, what would you want to do in this case? Retain only later survey record or both?
Go to Top of Page

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-05-16 : 09:48:59
Hi,

Yes I would like to retain both of the records attained in both months and yes there is definitely a chance that someone who participated in March will participate in April. So I just wanted to know of a way that I could display both months and other months to come (I am suppose to carry put the survey for a year).
The tables will basically consist of the regular client information (name,addresses,age,dob,spend,storename,storeid,transactiondate) but I was thinking that as I get the information I could just use a


Insert into Results
select cardnumber.....


and this should append the April data to March and then when I carry out this survey for May, it should append Mays' information to April and March etc etc
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-16 : 11:37:11
quote:
Originally posted by velvettiger

Hi,

Yes I would like to retain both of the records attained in both months and yes there is definitely a chance that someone who participated in March will participate in April. So I just wanted to know of a way that I could display both months and other months to come (I am suppose to carry put the survey for a year).
The tables will basically consist of the regular client information (name,addresses,age,dob,spend,storename,storeid,transactiondate) but I was thinking that as I get the information I could just use a


Insert into Results
select cardnumber.....


and this should append the April data to March and then when I carry out this survey for May, it should append Mays' information to April and March etc etc


Then i think a simple insert will do
Go to Top of Page
   

- Advertisement -