mysql text convert to field?
hi all. i would like to know how i can convert text to field.
for example:
BEGIN
declare test varchar(10);
set test="id,name";
SELECT test from m_question;
END
many thank for your help.
[255 byte] By [
luckroth] at [2007-11-20 11:37:32]

# 1 Re: mysql text convert to field?
MySQL 5 allows the following syntax:
PREPARE query FROM "SELECT id, name FROM m_question";
EXECUTE query;
The string ("SELECT id, name FROM m_question") can also be a variable (which is how you would insert "id, name" into the query.) Note that this won't work in functions or triggers (but will work in procedures.)