joelwenzel
Programmer
- Jun 28, 2002
- 448
Hi,
I want to pass a column name as a variable to a stored procedure. Is this possible? Here is something like what I want although it generates an error.
CREATE FUNCTION `GetMax`(ColName char(10)) RETURNS int(11)
BEGIN
DECLARE MaxScore INT;
SELECT Max(ColName) INTO MaxScore FROM Scores WHERE ColName >0;
return MaxScore;
END
I want to pass a column name as a variable to a stored procedure. Is this possible? Here is something like what I want although it generates an error.
CREATE FUNCTION `GetMax`(ColName char(10)) RETURNS int(11)
BEGIN
DECLARE MaxScore INT;
SELECT Max(ColName) INTO MaxScore FROM Scores WHERE ColName >0;
return MaxScore;
END