简体   繁体   English

如何使用SQL Server将值插入新表

[英]How can I insert values into a new table with sql server

I have 3 tables: 我有3张桌子:

vehicle, line, brands.

I need to insert the values of vehicle into a new table vehicleNew , the problem is that table vehicle has these columns vehicleId, lineName, brandsName 我需要将vehicle的值插入到新的表vehicleNew ,问题是该表vehicle具有以vehicleId, lineName, brandsName

The new table vehicleNew has vehicleId, lineCode, brandsCode how can I insert the values? 新表vehicleNew具有vehicleNew vehicleId, lineCode, brandsCode如何插入值?

insert into vehicleNew(vehicleId, lineCode, brandsCode)
    select vehicleId, lineName, brandsName from vehicle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM