ab_kol2004
دوشنبه 14 اردیبهشت 1388, 17:34 عصر
من از یک function استفاده کردم که avg بر میگردونه . رو dataی بالا مثلا 500000 کار نمی ده ولی رو dataی پایین کار می ده.چکار می تونم بکنم؟ ایا می تونم از چیزی بجای function استفاده کنم.
((SELECT xDonerOmorId_fk AS fg0, (dbo.Fn_Test2(xDonerOmorId_fk
ALTER FUNCTION [dbo].[Fn_Test2]
(
-- Add the parameters for the function here
@xDonerOmorId int
)
RETURNS int
AS
BEGIN
-- Declare the return variable here
DECLARE @Avg int
SELECT @Avg=AVG(dbo.vwReq_Delay.xCurrDelay)
FROM dbo.Req_Vw_StaticBase
where (xDonerOmorId_fk=@xDonerOmorId)
-- Return the result of the function
RETURN @Avg
((SELECT xDonerOmorId_fk AS fg0, (dbo.Fn_Test2(xDonerOmorId_fk
ALTER FUNCTION [dbo].[Fn_Test2]
(
-- Add the parameters for the function here
@xDonerOmorId int
)
RETURNS int
AS
BEGIN
-- Declare the return variable here
DECLARE @Avg int
SELECT @Avg=AVG(dbo.vwReq_Delay.xCurrDelay)
FROM dbo.Req_Vw_StaticBase
where (xDonerOmorId_fk=@xDonerOmorId)
-- Return the result of the function
RETURN @Avg