Hi,
here's a simple code example to add 2 values:
USE [Test01]
GO
/****** Object: UserDefinedFunction [dbo].[udf_GetStuff] Script Date: 06/19/2013 09:54:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:its me
-- Create date: 2013-06-19
-- Description:add 2 values
-- =============================================
CREATE FUNCTION [dbo].[udf_GetStuff]
(
-- Add the parameters for the function here
@p1 int = 0
, @p2 int = 0
)
RETURNS int
AS
BEGIN
-- Declare the return variable here
DECLARE @Result int
-- Add the T-SQL statements to compute the return value here
SET @Result = @p1 + @p2
-- Return the result of the function
RETURN @Result
END
Call the udf in SSMS:
DECLARE @RET int
EXEC @RET = dbo.udf_GetStuff 44, 22
Select 'Sum= ', @RET
varReturn = .OpenRecordset.GetRows
is really an improvement because returning a Table Valued UDF returning a table can be handled. thanx for this hint:-)
--
candide
________Panta rhei