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
 General SQL Server Forums
 New to SQL Server Programming
 temporary table

Author  Topic 

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2007-07-29 : 18:41:55
Hi,

i have:

[first table]
user_id
user_name
user_password

[second table]
set
item
order

Since the second table is somehow only temporary table (having at the front ajax script), i need the third table to store user's ID and all the info from second table.

What would be the easiest way to do it, since the first table contains only one row per user and the second one 40 rows per user.

thank you for your thought!

nr
SQLTeam MVY

12543 Posts

Posted - 2007-07-29 : 22:06:39
No idea what you mean but
insert table3
select t1.Userid, t2.set, t2.item, t2.Order
from table1 t1
cross join table2 t2
where t1.Userid = @myuserid


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2007-07-30 : 12:32:22
hi,

sorry for being so vague.

The main problem i have is that all data are written in db dynamicly and what i need is to have a third table to preserve/save all corresponding data from table 1 and table 2.

is there any easy/fast way to do it?
Go to Top of Page
   

- Advertisement -