Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have two tables the SQL database, a user table and the user_events table .On button click i need to retrieve userid from user table and insert into a column in the user_events table.Can anyone tell me how to achieve the task on asp button click. I would be thankful if anybody suggest me an alternative for this.
Posted
Updated 12-Jul-20 21:22pm

Try this :
SQL
INSERT INTO UserEvents(UserId)
SELECT UserId
FROM User
WHERE UserName='XXX'


Have a look at :http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/[^]
this might help you
 
Share this answer
 
Comments
__TR__ 20-Nov-12 2:52am    
5ed!
This could be one way to do this:

SQL
SELECT *
INTO Persons_Backup
FROM Persons
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900