且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有没有“分裂"?用于 SELECT 查询的 t-sql 中的函数

更新时间:2023-02-05 22:37:08

它应该可以正常工作,但您需要对函数进行模式限定.

It should work fine, but you need to schema-qualify functions.

浏览器:

SELECT dbo.BaseSplit(line,';') FROM table

如果您的函数在与 dbo 不同的架构中,您显然应该改用它.

If your function is in a different schema than dbo you should obviously use that instead.

好的 - 假设它是一个表值函数然后......

OK - assuming its a table valued function then...

SELECT t.Id, f.*  FROM table AS t CROSS APPLY dbo.BaseSplit(line,';') AS f

这将为每个分割线返回一行 + 主表中该条目的 ID(假设主表中存在名为 Id 的列).如果您想要更好,我将需要一个您期望的输出示例

That would return a row for each split line + the ID of the that entry in the main table (assuming a column named Id exists in the main table). If you want better that that I'm going to need an example of what output you expect