CREATE FUNCTION [dbo].[GetReportDWCustomerOrder] (
@YearDate DATETIME,
参数条件.....
@CategoryName NVARCHAR(500)
)
RETURNS @Crm_Pj_DWCustomerOrder TABLE
(OrderNo NVARCHAR(100),
字段定义...
Amount DECIMAL(38,6)
)
AS
BEGIN
--这里插入数据
INSERT INTO @Crm_Pj_DWCustomerOrder
( OrderNo ,
字段补充...
Amount
)
SELECT
OrderNo,
字段补充...
Amount
FROM 表或者视图
WHERE 过滤条件
RETURN --返回
END