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.
我的内联表值函数返回@table,目前我正在考虑创建要计算的字段并将公式添加到其计算列规范的可能性。我认为这可能是减少函数中 sql 语句数量的更好方法。
那么,它是否支持功能中的此类功能?
是的你可以:
create function foo ( @seed int ) returns @foo_t table ( [a] int not null, [b] int not null, [c] as ([a] + [b]) ) begin insert into @foo_t values (@seed, 2) insert into @foo_t values (@seed + 1, 3) return end go select * from foo(1) go