Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 number of function calls?

Author  Topic 

Dargon
Starting Member

26 Posts

Posted - 2006-01-31 : 11:03:46
Hi all,
I have user defined function, pretty simple one, which gets called from set of stored procedures. I wonder, if it is any way to figure out how many times function called when running an application.
I can not update any counters from function. Is it any way to see it using SQL profiler of other tools?
Just in case, here is function itself, it just converts quantity.

Thanks, Dargon

ALTER FUNCTION [dbo].[ConvertQuantity]
( @qty AS FLOAT, @from_unit AS INT, @to_unit AS INT )
RETURNS FLOAT
AS
BEGIN
DECLARE @from_scaler AS FLOAT
DECLARE @from_offset AS FLOAT
DECLARE @to_scaler AS FLOAT
DECLARE @to_offset AS FLOAT
DECLARE @converted AS FLOAT



IF ( 0 > @to_unit ) -- don't do conversion if target unit id is -1
BEGIN
RETURN @qty
END
-- else ...
SET @converted = @qty

SELECT @from_scaler=Scaler, @from_offset=Offset FROM UOM WHERE [UOM].UoM=@from_unit
SELECT @to_scaler=Scaler, @to_offset=Offset FROM UOM WHERE [UOM].UoM=@to_unit

IF ( 0.0 != @to_scaler )
BEGIN
SET @converted = ((( @qty + @from_offset ) * @from_scaler )/@to_scaler ) - @to_offset
END
RETURN @converted
END
   

- Advertisement -