开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜