Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printing variable values from within a UDF

Status
Not open for further replies.

Deathsbain

Programmer
Sep 17, 2007
3
US
ok... i have a stored procedure (SP) that calls one of my UDF's... in the call it is supposed to pass 5 different variables... but my problem is that the end result is not coming out. here is a code snipit from the stored procedure...

Code:
count(*) as Instances,
sum(OutportMinutes) as RatedDuration,
coalesce(sum(TerminationCost),0) as Cost,

/****************************************************
 ** Here is the call to the function that does the calculation for the  **
 ** internal cost adjustment. This function replaces the commented **
 ** code that can be found in __CLEANUP_INFORMATION    **
 ****************************************************/
sum(dbo.fn_InternalCostAdjustments(@tempOwner, @tempJurisdiction, IsInternational, TerminationCost, @startdate))

as Price
from BSSGatheredTerm
where CallDate between @startdate and @enddate

what i want to do is inside of my UDF i would like to just do a checksum and see if the variables are actually being passed correctly...

here is the top of the UDF...
Code:
********************************************************************************************************/
CREATE FUNCTION dbo.fn_InternalCostAdjustments (@owner varchar, @isOrigOrTerminate numeric(38,6), @isInternational numeric(38,6), 
								@terminationCost numeric(38,6), @startDate datetime)  
RETURNS numeric(38,6)
/*******************************
 ** START OF FUNCTION BODY **
 *******************************/
BEGIN

/********************
 * TEMP CHECKSUM *
 ********************/
DECLARE @printout varchar
SET @printout = (@owner + @isOrigOrTerminate + @isInternational + @terminationCost + @startDate)
--print @printout


please... any and all help is appreciated...



Thanks a million for all your help!!!


Deathsbain - Have you hugged your undertaker today???
 
Hi
PRINT statements are not possible in UDFs
. Use RETURN
I would recommend for debugging , make the UDF a sp and then call, you can then have PRINT statemenst


All the IT jobs in one place -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top