問題
如何 撰寫Function
解決方法
IF EXISTS ( select * from sysobjects where id=OBJECT_ID(N'[f_Count_Amt]') and xtype in (N'FN',N'IF',N'TF') ) DROP FUNCTION [f_Count_Amt] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE FUNCTION [f_Count_Amt] ( -- Add the parameters for the function here @amt decimal(18,6) ,@number int ) RETURNS @Count TABLE ( -- Add the column definitions for the TABLE variable here Total_amt decimal(18,6) ) AS BEGIN -- Fill the table variable with the rows for your result set insert into @Count values (@amt*@number) RETURN END
沒有留言:
張貼留言