Friday, February 17, 2012

data from one table into another

I have searched for this answer without success, probably not hard enough.

I want to take the data from one field in a table, and place it in another field in another table. c#

Database1.InsertCommand = "insert INTO

I just want the id in table one to be put in table 2

That much depends on the rows where you want to transfer the values to already exists on the other table (then you will have to do an update)

UPDATE SomeOtherTable
SET SomeColumn = SomeTable.Id
FROM SomeOtherTable
INNER JOIN SomeOtherTable Sot
ON SomeTable ST
Sot.SomeColumnToJoin = St.SomeColumnToJoin

or the rows do not exists yet

INSERT SomeOtherTable
(SomeColumn)
SELECT SomeColumn
FROM SomeTable

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||

Thankyou for spending the time jens.

That does answer the question. All I have to do now is put

that into c#

No comments:

Post a Comment