Monday, February 13, 2012

Copy Specific Cells between Tables based on Login ID

I want to copy FirstName and LastName cells from table1 to table2. Which FirstName and LastName cells depend on the username, i.e. which person has logged in.

Q1) How can this be done? (I have chosen to SELECT from Table1 and output to variables (C# code); then INSERT these variables into Table2. [Finding it very difficult]).

Any suggestions/comments would be appreciated. Thank you in advance.

You can achieve what you need in a single statement

In SQL Server and Oracle

insert into test3 (lib_id, lib_name, lib_desc)
select lib_id, lib_name, lib_desc from test2 where lib_id=1


No comments:

Post a Comment