It doesn't like the limit line below. How would I use the variable @row in this case to limit the result set?
SELECT @row := 5;
SELECT * FROM MyTable
limit @row
Error:
Unexpected '@row'
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be nonnegative integer constants https://dev.mysql.com/doc/refman/8.0/en/select.html
So,
SELECT * FROM MyTable
limit 5
? placeholders in prepared statements, or in stored routines you can use integer-typed routine parameters or local variables. But not user variables, which have no declared type.