How to create dynamic table in mySql
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
@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.
Pretty easy to do:
CREATE TABLE AS
SELECT * FROM tblCustomer
It will take the existing field types from the schema where possible..
精彩评论