Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将所有 id 值传递给函数。我怎样才能做到这一点?
就像我可以循环所有 id 并为这些有趣的标量函数传递所有 id
empFn(emp.[id])
您可以使用表值参数来执行此操作:
http://msdn.microsoft.com/en-us/library/bb510489.aspx
网上有很多很多例子。
如果我的问题正确,您应该使用CROSS APPLY
SELECT * FROM dbo.employees emp CROSS APPLY (SELECT * FROM dbo.empFn(emp.[id]))