SQL Join table-valued function with table where table field is a function input

后端 未结 1 590
猫巷女王i
猫巷女王i 2021-01-12 00:31

I have a table-valued function called fn_SplitCommaSep, which comma-separates a text field (from \'a, b, c\' to 3 rows: a b c)

How can I join this to a table, taking

相关标签:
1条回答
  • 2021-01-12 01:01

    Storing comma-separated values in a DB aside, take a look at APPLY

    So something like:

    SELECT fs.TextWithoutComma, mt.Id 
    FROM   MyTable mt 
        CROSS APPLY fn_SplitCommaSep(mt.TextWithCommas) AS fs
    
    0 讨论(0)
提交回复
热议问题