简体   繁体   中英

Conversion of MySQL schema on top of HANA DB?

I have following SQL command dumped from MySQL. How should I make it HANA DB acceptable version from this?

CREATE SCHEMA foodb;
SET SCHEMA foodb;

--- DROP TABLE  auth_privilege;
CREATE COLUMN TABLE auth_privilege (
  ID BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '0:league, 1:team, 2:leagueteam, 3:match',
  USER_ID BIGINT(20) NOT NULL,
  TYPE INT(10) NOT NULL,
  LEAGUE_ID BIGINT(20) DEFAULT NULL,
  TEAM_ID BIGINT(20) DEFAULT NULL,
  LEAGUETEAM_ID BIGINT(20) DEFAULT NULL,
  MATCH_ID BIGINT(20) DEFAULT NULL,
  PRIMARY KEY (ID),
  KEY FK_USER_ID_privilege (USER_ID),
  KEY FK_LEAGUE_ID_privilege (LEAGUE_ID),
  KEY FK_TEAM_ID_privilege (TEAM_ID),
  KEY FK_LEAGUETEAM_ID_privilege (LEAGUETEAM_ID),
  KEY FK_MATCH_ID_privilege (MATCH_ID),
  CONSTRAINT FK_LEAGUETEAM_ID_privilege FOREIGN KEY (LEAGUETEAM_ID) REFERENCES tf_leagueteam (ID),
  CONSTRAINT FK_LEAGUE_ID_privilege FOREIGN KEY (LEAGUE_ID) REFERENCES td_league (ID),
  CONSTRAINT FK_MATCH_ID_privilege FOREIGN KEY (MATCH_ID) REFERENCES tf_match (ID),
  CONSTRAINT FK_TEAM_ID_privilege FOREIGN KEY (TEAM_ID) REFERENCES td_team (ID),
  CONSTRAINT FK_USER_ID_privilege FOREIGN KEY (USER_ID) REFERENCES auth_user (ID)
);

...... It continues

This is what I got from the dumped MySQL with a bit of beginner modification. What you suggest to do for making it working?

Also if you know any external tool doing this conversion by itself, it is better to go.

ERROR from above statements

Could not execute 'CREATE COLUMN TABLE auth_privilege ( ID BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '0:league, ...' in 67 ms 771 µs . 
SAP DBTech JDBC: [257] (at 43): sql syntax error: incorrect syntax near "(": line 2 col 6 (at pos 43) 

The datatype BIGINT does not allow you to specify a length. So instead of using eg a bigint with a length of 20 (which does not exist) you might want to go for a regular INTEGER .

For your comparision:

BIGINT
    64 Bit Integer
    Min Value:  −9.223.372.036.854.775.808
    Max Value:   9.223.372.036.854.775.807

INTEGER
    32 Bit Integer
    Min Value:  −2.147.483.648
    Max Value:   2.147.483.647

Also refer to http://support.sas.com/documentation/cdl/en/ds2ref/67313/HTML/default/viewer.htm#n1lucga3y42edtn1mpsgct68t28t.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM