C# 从另一个表在表中插入值

C# 从另一个表在表中插入值,c#,sql-server,C#,Sql Server,请有人帮助我在sql server 我有一个带有列(保留、名称、价格) 和另一个列为(名称、价格) 我想在表1(价格)中插入表2(价格)中的值作为答案发布: 如果您试图将表1中的价格列更新为表2中的值(价格): 查询:将数据从一个表插入到另一个表 1)使用Insert into:当先前已在数据库中创建了表,并且要将数据从另一个具有相同架构的表插入到该表中时,使用该选项 2)使用Select into:仅当into子句中指定的表不存在时才使用。它将创建与所选列相同的数据类型的新表 select n

请有人帮助我在
sql server

我有一个带有列
(保留、名称、价格)

和另一个列为
(名称、价格)

我想在
表1(价格)
中插入
表2(价格)
中的值作为答案发布:

如果您试图将表1中的价格列更新为表2中的值(价格):


查询:将数据从一个表插入到另一个表

1)使用Insert into:当先前已在数据库中创建了表,并且要将数据从另一个具有相同架构的表插入到该表中时,使用该选项

2)使用Select into:仅当into子句中指定的表不存在时才使用。它将创建与所选列相同的数据类型的新表

select name,price into tb3 from tb2;

检查以下内容:
 insert into tb1 (name,price) select name,price from tb2;
INSERT INTO TABLE1(Price) 
(
    SELECT Price FROM TABLE2
)
UPDATE TBL1
SET    TBL1.Price = TBL2.Price
FROM   Table1 TBL1
INNER JOIN Table2 TBL2 ON TBL1.name = TBL2.name
 insert into tb1 (name,price) select name,price from tb2;
select name,price into tb3 from tb2;