Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account

How to create dynamic table in mySql

0

43 views

Hai all,

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

asked May 19, 2011 6:40 am CDT
posted via StackOverflow

2 Answers

0
 

Pretty easy to do:

 CREATE TABLE AS
 SELECT * FROM tblCustomer

It will take the existing field types from the schema where possible..

answered May 19, 2011 7:23 am CDT
0
 
@sqlstmt = 'whatever sql';
Prepare st from @stlstmt;
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.

answered May 19, 2011 7:23 am CDT

Your answer

Join with account you already have


Sign in with Twitter account
Sign in with Facebook account
Sign in with Google Friend Connect

Preview
Similar questions
MySQL create table
April 13, 2011
Create table mysql
April 15, 2011