开发者

TSQL how do you insert rows from a table returned by function for each values in another table?

开发者 https://www.devze.com 2023-01-10 16:27 出处:网络
sorry for the poorish description it is really hard to explain what I am trying to do. But this is some pseudo:

sorry for the poorish description it is really hard to explain what I am trying to do. But this is some pseudo:

foreach (row in Table1)
    insert Tab开发者_JAVA百科le2 select * from getValuesTable('text', row.Column1)

I'm not too sure how to get that initial join together because it will not allow me to alias the returned table from getValuesTable. Any help would be appreciated :) Thanks.


You can use Cross Apply to execute the function for each row in Table1

Insert Table2(...)
Select ...
From Table1
    Cross Apply GetTableValues('text',Table1.Column1)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号