Reputation: 9016
I want to know how to create dynamic table in mySql . I have used dynamic table in Sqlserver 2008 but i am new to mySql . Is it possible ?
Eg: In Sql server i have created Dynamic Customer Table.
DECLARE @tblCustomer as table(
[ ] bit
,Sl# int
,custID int
,CustCode varchar(max)
,Customer nvarchar(max)
,Authorized bit
,RCount int)
SELECT * FROM @tblCustomer
Please Help
Upvotes: 1
Views: 5859
Reputation: 44343
@sqlstmt = 'whatever sql';
Prepare st from @sqlstmt;
Execute @st;
Deallocate prepare @st;
Place the CREATE TABLE statement in @sqlstmt and you are good to go !
The table is a real one. You would have to drop the table afterwards.
Upvotes: 2
Reputation: 13435
Pretty easy to do:
CREATE TABLE AS
SELECT * FROM tblCustomer
It will take the existing field types from the schema where possible..
Upvotes: 1