t-sql 插入 - 选择 - 带参数 [英] t-sql insert - select - with parameters
本文介绍了t-sql 插入 - 选择 - 带参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 4 张桌子.我们将要向其中插入数据的表之一(表 A).表 A 将接收来自表 B、C、D 的杂项数据以及一些未知的可变参数数据.
I have a 4 tables. One of the tables we are going to be inserting data into (Table A). Table A is going to receive misc data from Table B, C, D and also some unknown variable parameter data.
如何使用 SELECT 设置 INSERT 并接收参数?
How do I set up the INSERT with a SELECT with also receiving parameters?
推荐答案
类似的事情?
Insert INTO TableA (col1, col2,col3,col4)
SELECT b.col1, c.col2, d.col3, @myparam
FROM TableB as b
INNER JOIN TableC as c
ON b.id = c.id
INNER JOIN TableD as d
on c.id = d.id
这篇关于t-sql 插入 - 选择 - 带参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文