> I'm trying to create a passoff script for a database class and
> don't want to restrict the students to using the names which I'm
> using.

Here you go...

mysql> create table University ( msg varchar(255) );
Query OK, 0 rows affected (0.04 sec)

mysql> insert into University (msg) values ('Hello, World!');
Query OK, 1 row affected (0.00 sec)

mysql> set @table = 'University';
Query OK, 0 rows affected (0.00 sec)

mysql> set @stmt = CONCAT("SELECT * FROM ", @table);
Query OK, 0 rows affected (0.00 sec)

mysql> prepare pstmt from @stmt;
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql> execute pstmt;
+---------------+
| msg           |
+---------------+
| Hello, World! |
+---------------+
1 row in set (0.00 sec)

mysql> deallocate prepare pstmt;
Query OK, 0 rows affected (0.00 sec)

Reply via email to