Incorrect syntax error next to engine

0

I would like you to help me. The following error is appearing:

  

MESSAGE 102, LEVEL 15, STATUS 1, LINE 17-SINTAX INCORRECT NEXT TO% with%

But I did not find it.

CREATE TABLE SITE (
    SITE_ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
    SITE_NAME VARCHAR(255) NOT NULL DEFAULT '',
    SITE_DOMAIN_NAME VARCHAR(255) NOT NULL DEFAULT '',
    SITE_LOGO VARCHAR(255) NOT NULL DEFAULT '',
    SITE_TITLE TEXT NOT NULL,
    SITE_DESCRIPTION TEXT NOT NULL,
    SITE_KEYWORDS TEXT NOT NULL,
    SITE_MENU CHAR(3) NOT NULL DEFAULT '',
    SITE_BGCOLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_BODY_BGCOLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_MENU_COLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_ROLL_COLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_MENU_FONT VARCHAR(255) NOT NULL DEFAULT '',
    SITE_FONT_SIZE VARCHAR(255) NOT NULL DEFAULT '',
    SITE_ACTIVE CHAR(3) NOT NULL DEFAULT 'YES'
) ENGINE=MyISAM AUTO_INCREMENT=1;
    
asked by anonymous 19.05.2017 / 07:39

2 answers

1

The IDENTITY (1, 1) statement is not valid for MySQL (it is a valid statement for SQL Server).

The equivalent for MySQL is AUTO_INCREMENT

CREATE TABLE SITE 
(
    SITE_ID INT NOT NULL PRIMARY KEY,
    SITE_NAME VARCHAR(255) NOT NULL DEFAULT '',
    SITE_DOMAIN_NAME VARCHAR(255) NOT NULL DEFAULT '',
    SITE_LOGO VARCHAR(255) NOT NULL DEFAULT '',
    SITE_TITLE TEXT NOT NULL,
    SITE_DESCRIPTION TEXT NOT NULL,
    SITE_KEYWORDS TEXT NOT NULL,
    SITE_MENU CHAR(3) NOT NULL DEFAULT '',
    SITE_BGCOLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_BODY_BGCOLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_MENU_COLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_ROLL_COLOR VARCHAR(255) NOT NULL DEFAULT '',
    SITE_MENU_FONT VARCHAR(255) NOT NULL DEFAULT '',
    SITE_FONT_SIZE VARCHAR(255) NOT NULL DEFAULT '',
    SITE_ACTIVE CHAR(3) NOT NULL DEFAULT 'YES'
) ENGINE=MyISAM AUTO_INCREMENT=1;

Note that AUTO_INCREMENT = 1 only specifies the beginning of the sequence. To set the increment interval you can use the auto_increment_increment variable, dev

    
19.05.2017 / 09:51
0

Lisa, see if putting the 'AUTO_INCREMENT' together with the 'PRIMARY KEY' statement works. So:

CREATE TABLE SITE(
 SITE_ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY AUTO_INCREMENT, 
 SITE_NAME VARCHAR(255) NOT NULL DEFAULT '',
 SITE_DOMAIN_NAME VARCHAR(255) NOT NULL DEFAULT '',
 SITE_LOGO VARCHAR(255) NOT NULL DEFAULT '',
 SITE_TITLE TEXT NOT NULL,
 SITE_DESCRIPTION TEXT NOT NULL,
 SITE_KEYWORDS TEXT NOT NULL,
 SITE_MENU CHAR(3) NOT NULL DEFAULT '',
 SITE_BGCOLOR VARCHAR(255) NOT NULL DEFAULT '',
 SITE_BODY_BGCOLOR VARCHAR(255) NOT NULL DEFAULT '',
 SITE_MENU_COLOR VARCHAR(255) NOT NULL DEFAULT '',
 SITE_ROLL_COLOR VARCHAR(255) NOT NULL DEFAULT '',
 SITE_MENU_FONT VARCHAR(255) NOT NULL DEFAULT '',
 SITE_FONT_SIZE VARCHAR(255) NOT NULL DEFAULT '',
 SITE_ACTIVE CHAR(3) NOT NULL DEFAULT 'YES' 
) ENGINE=MyISAM;
    
19.05.2017 / 07:54