|
Prev: from a stored procedure: how to return datasets and their table names
Next: How to construct check constraint to allow only one 'True' flag per vendor
From: Jeffrey Williams on 6 Jul 2008 15:22 John Bell wrote: > > Just to complicate things further how about a function? > > CREATE FUNCTION AddParams ( @x float, @y float ) > RETURNS FLOAT > BEGIN > RETURN @x + @y > END > > > DECLARE @x float, @y float, @z float > SELECT @x =1.234, @y =2.123 > > SET @z = dbo.AddParams ( @x, @y ) > > SELECT @x, @y, @z > > John John, I don't think this complicates anything at all. It really depends upon what the actual logic is in the 'InnerProcedure' - but this does look like just what functions have been designed to do. I would say that a function is the better solution in this case, unless there is some logic that prevents a function from being used. Jeff |