drop procedure if exists table_columns;
delimiter ;;
create procedure table_columns(_table varbinary(255))
not deterministic
reads sql data
begin
if @nl then
select group_concat(column_name separator ',\n') as columns
frominformation_schema.columnswhere table_schema=database() and table_name=_table;
else
select group_concat(column_name separator ', ') as columns
frominformation_schema.columnswhere table_schema=database() and table_name=_table;
end if;
end;;
drop procedure if exists table_columns_nl;
create procedure table_columns_nl(_table varbinary(255))
not deterministic
reads sql data
beginset @nl :=1;
call table_columns(_table);
end;;
delimiter ;