views:

43

answers:

3
CREATE TABLE PERMISSIONS(
   ID BIGINT NOT NULL PRIMARY KEY,
   NAME VARCHAR(255) NOT NULL, UNIQUE(ID)
) 
CREATE TABLE ROLES(
   ID BIGINT NOT NULL PRIMARY KEY, 
   NAME VARCHAR(255)
)

I want to run this in MySql. When I try to execute separately each create-query everything works fine but they don't work together. I thought that separator was missed and tried to put semicolon after each query but MySql says that I have syntax mistake near ";" . Where is the mistake?

A: 

I don't have a MySql instance running here and it's by no means my cup of tea but I believe you're supposed to separate your queries with ;.

CREATE TABLE PERMISSIONS(
   ID BIGINT NOT NULL PRIMARY KEY,
   NAME VARCHAR(255) NOT NULL, UNIQUE(ID)
) ;
CREATE TABLE ROLES(
   ID BIGINT NOT NULL PRIMARY KEY, 
   NAME VARCHAR(255)
)
Lieven
A: 

using the queries in the mysql console with a semi-colon after the each statement works. maybe you use an api (like php's mysql_query) which only supports one query at the time.

Rufinus