Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » PHP




 Page 1 of 1 [ 1 post ] 



Author Message
 Post subject: User defind func tryin 2 use te temp table
 Post Posted: Thu Nov 12, 2009 11:37 am 
Offline

Joined: Sat Feb 21, 2009 2:25 pm
Posts: 51
I was been tryin 2 use a temp tab within the user defined func 2
calculate sum of the fields gettin the totals., i am gettin an error
message i cant use temp tables with in the user defind functions, was there
ne other way, Please do help.

thanks in advance!!!

Code:

CREATE FUNCTION [dbo].[UDF_getEFundAllocatedAmount]
(
   @efundid int,
   @Elementid   int
)
RETURNS bit
AS
BEGIN
DECLARE @AllocatedFundAmt   float

CREATE TABLE #TempEFundAllocated(
efundid   int,
eFundAmt float
);

Insert INTO #TempEFundAllocated(efundid,eFundAmt)
(Select @efundid, isnull(Month1,0) + isnull(month2,0) + isnull(month3,0) from Tbl_RevenueCashFlow where Fundid=@efundid and elementid=@Elementid)


SET @AllocatedFundAmt = 0

SET  @AllocatedFundAmt = (Select isnull(sum(eFundAmt),0) from #TempEFundAllocated)

RETURN @AllocatedFundAmt;

END


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 1 post ] 




Board index » Server Side Development » PHP


Who is online

Users browsing this forum: No registered users and 2 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron