distal-attribute
distal-attribute
distal-attribute
distal-attribute

Syntax for Creating Temporary Table

User, date Message
Written by JDizzler
2 months ago
Category: General
2 posts since Wed, 04 Jun 14
I am trying to create a temporary table to get some data from other tables.


CREATE TABLE #temps
(
id int,
agentCnt int,
serviceTeamCnt int

PRIMARY KEY (id)
)


The error I'm getting is

/* SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(
VId int,
id int,
agentCnt int,
serviceTeamCnt int

' at line 2 */

Does heidi not create temporary tables using this syntax? If not what could you suggest? I'm a big noob at this so any help would be greatly appreciated

Written by jfalchMoney, Euro
2 months ago
382 posts since Sat, 17 Oct 09
a) non-alphanum tabel name must be quoted (ie `#temps`)
b) there must be a comma after last field def

CREATE TABLE `#temps` (
id int(11),
agentCnt int,
serviceTeamCnt int,

PRIMARY KEY (id)
)

works on my server.
Written by JDizzler
2 months ago
2 posts since Wed, 04 Jun 14
Yeah that works great thanks. and I found another way just now.
It also works using this syntax

CREATE TEMPORARY TABLE temps
(
id int,
agentCnt int,
serviceTeamCnt int,
)

Also thanks for the a and b tips. It helps a lot
 

Please login to leave a reply, or register at first.