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:
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:
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...
Custom Apps, Inc.