I have the following procedure code snippet....
[sql]... DECLARE tablename VARCHAR(20);SET tablename = Table_Name;SELECT YEAR(RegDate) AS `Year`, QUARTER(RegDate) AS `Quarterly`, COUNT(`REGID`) AS NoIssueQuarterFROM tablenameWHERE .... /* Table_Name is the parameter while tablename is the variable */ [/sql]
However when I try to execute the procedure (Table_Name = 'debts') I get the error
How do you pass the variable off as the table to be used in the SQL statement?SQL Error: Unknown column 'debts' in 'field list'