i need thing like set @var= exec calculate 'param' are this true
A:
You should be using output parameters for the stored procedure:
DECLARE @output1 INT
EXEC [proc] @input, @output1 OUTPUT
PRINT @output1
spinon
2010-08-02 09:01:29
+2
A:
DECLARE @ret INT
DECLARE @output INT
EXEC @ret = [proc] @input, @output OUTPUT
SELECT @ret, @output
@ret
is the return value: RETURN -1
@output
is an assignable variable of any type: SET @output = 123
Scoregraphic
2010-08-02 09:06:05
A:
A function is a good place to perform a commonly used calculation.
CREATE FUNCTION dbo.ufnAddIntegers
(@pint1 as int, @pint2 as int)
RETURNS int
AS
BEGIN
return @pint1 + @pint2
END
go
declare @intResult int
set @intResult = dbo.ufnAddIntegers(3, 4)
select Result = @intResult
/*
Result
-----------
7
*/
thanks @peterellis its good solution.put whats diffrence between functions and stored procedure
shmandor
2010-08-03 09:22:35