摘要:
--标量函数--创建函数create function Fun_Cost(@x int,@y money)returns moneyasbegin return (@x*@y)end--使用函数alter table goods add 金额 as dbo.Fun_cost(数量,进货价)go--验证函数select * from Goodsgo--表值函数--1\内嵌表值函数create function Fun_Total(@bt datetime,@ef datetime)returns tableasreturn (select goods.商品名称,sell.数量 from good 阅读全文