Click here to Skip to main content
15,743,541 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

am working on SqlServer 2005. I have two tables in my Database.

Table 1 is history
Table 2 is UserDetails

I have a table name with History, In this i have a coulmn name 'TimeStamp' Now I need to copy all these data to userDetails table.

How to copy only a particular column to another table in sqlserver 2005.. Help me.

thanks in advance.
zaid Qureshi 6-Nov-12 6:36am    
jst try with copy n paste

This may help you
Insert into UserDetails(TimeStamp)
select TimeStamp from History
Share this answer
if you are copying all the record, and inserting them as new then

Insert into UserDetails(TimeStamp)
select TimeStamp from History

but if you are copying from history table and inserting them to existing column then

update userDetails set TimeStamp= (select TimeStamp from history where history.userID= UserDetails.UserID)
--modify the condition to your needs,

this will not insert records as new, but will only update the existing records.
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