在HANA DB之上转换MySQL架构?

时间:2014-09-18 12:19:29

标签: mysql sql hana

我有以下从MySQL转储的SQL命令。我应该如何使其成为HANA DB可接受的版本?

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

这是我从倾销的MySQL中获得的一些初学者修改。您建议如何使其正常工作?

此外,如果你知道任何外部工具自己进行这种转换,那么最好去。

上述陈述中的错误

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) 

1 个答案:

答案 0 :(得分:0)

数据类型BIGINT不允许您指定长度。所以不要使用例如一个长度为20的bigint(不存在)你可能想要定期INTEGER

您的比较:

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

另请参阅 http://support.sas.com/documentation/cdl/en/ds2ref/67313/HTML/default/viewer.htm#n1lucga3y42edtn1mpsgct68t28t.htm