The FUNCTION the CREATE [the dbo]. [GetReportDWCustomerOrder] (
@YearDate DATETIME,
parameter condition .....
@CategoryName NVARCHAR (500)
)
the RETURNS TABLE @Crm_Pj_DWCustomerOrder
(the OrderNo NVARCHAR (100),
field definitions ...
the Amount DECIMAL (38,6 )
)
the AS
the BEGIN
- here insert data
the iNSERT the INTO @Crm_Pj_DWCustomerOrder
(the OrderNo,
field supplement ...
the Amount
)
the SELECT
the OrderNo,
field supplement ...
the Amount
the FROM table or view
wHERE filter condition
rETURN - return
END
SQL Server returns a list of field data by defining a template function - Dry
Guess you like
Origin www.cnblogs.com/hualiuliu/p/11457307.html
Ranking