I got a question regarding create temporary table in mysql.
Let's say i create temporary table in my code,
CREATE Temporary TABLE table.T2 (select * from testing.Category)
izzit after " myConnection.Close() " all the temporary i create will disappear?
So if yes, is there any better way to prevent the table disappear/dropped from database as i need to select the data in temporary and populate it to gridview.
You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name
without conflicting with each other or with an existing non-TEMPORARY table of the same name. The existing table is hidden until the temporary table is dropped.) To create temporary tables, you must have the CREATE TEMPORARY TABLES privilege.
When you use temporary it will be available only for that connection. If you want to make available the same table for another connection remove the temporary key word from your query and then use.
Marked as answer by Mark - MSFT on Mar 08, 2013 12:19 AM
Jane1987
Member
13 Points
47 Posts
Create Temporary Table in Mysql
Feb 26, 2013 05:35 AM|LINK
Hi all,
I got a question regarding create temporary table in mysql.
Let's say i create temporary table in my code,
CREATE Temporary TABLE table.T2 (select * from testing.Category)
izzit after " myConnection.Close() " all the temporary i create will disappear?
So if yes, is there any better way to prevent the table disappear/dropped from database as i need to select the data in temporary and populate it to gridview.
Thanks.
farooque84
Participant
1358 Points
321 Posts
Re: Create Temporary Table in Mysql
Feb 26, 2013 06:29 AM|LINK
Hi,
You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. The existing table is hidden until the temporary table is dropped.) To create temporary tables, you must have the CREATE TEMPORARY TABLES privilege.
Please refer below links,
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
http://www.tutorialspoint.com/mysql/mysql-temporary-tables.htm
http://www.linuxplanet.com/linuxplanet/tutorials/6889/1
prabu.raveen...
Contributor
5020 Points
955 Posts
Re: Create Temporary Table in Mysql
Feb 26, 2013 06:43 AM|LINK
When you use temporary it will be available only for that connection. If you want to make available the same table for another connection remove the temporary key word from your query and then use.
Jane1987
Member
13 Points
47 Posts
Re: Create Temporary Table in Mysql
Feb 26, 2013 07:00 AM|LINK
Hi,
That means after myconnection.close(), the temporary table will drop itself?