Bad news.
I can only speak to SQL Server, but there is no simple, easy way to do this. There is no MIN function which will return the minimum of two values. The MIN is an SQL aggregate function which returns the minimum value in a set of rows.
If you are using SQL Server 2k, you could write a user defined function which would return the minimum of its two arguments, then add code to the stored procedure like:
Code:
set @minNumber=MyMin(@num1,@num2)
set @minNumber=MyMin(@minNumber,@num3)
...
You could create a temporary table (in SQL Server 2K this can be an in-memory table variable) containing the values you wish to search and use the MIN aggregate to find the minimum of them all:
Code:
DECLARE @MyTable table(NumberColumn int not null)
INSERT @MyTable (Numbercolumn) VALUES (@num1)
INSERT @MyTable (Numbercolumn) VALUES (@num2)
...
SELECT @minNumber=MIN(numbercolumn) FROM @MyTable;
There are other ways involving a series of IF statements or CASE Expressions which may be simpler and quicker...
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com