Incorrect syntax error next to engine

Asked

Viewed 484 times

0

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

MESSAGE 102, LEVEL 15, STATUS 1, LINE 17-INCORRECT SYNTAX NEXT TO ENGINE

but I couldn’t find him.

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;

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 the AUTO_INCREMENT = 1 only specifies the start of the sequence. To set the interval of the increment you can use the variable auto_increment_increment, dev

0

Lisa, see if putting the 'AUTO_INCREMENT' along with the 'PRIMARY KEY' statement works. Like this:

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;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.