Installation has syntax error relating to 'Groups' in Repository creation

More
2 years 4 months ago - 2 years 4 months ago #23294 by prashant
Hello,
To create a new repo wizard which requires mySQL I always get error, upon running the errors via chatGPT I get some solution , but not wholly 

I swear if we could upgrade our MSSql it would be so much easier and better
The formatting is completely messed up below, I can't figure why

Error 1
Code:
CREATE TABLE 'GROUPS' ( GROUP_ID NUMERIC NOT NULL , GROUP_NAME NVARCHAR(80) DEFAULT NULL, CREATED DATETIME DEFAULT NULL, CREATED_BY NVARCHAR(32) DEFAULT NULL, CHANGED DATETIME DEFAULT NULL, CHANGED_BY NVARCHAR(32) DEFAULT NULL ) ; Following Error happened: [MySQL][ODBC 8.3(w) Driver][mysqld-8.3.0]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUPS ( GROUP_ID NUMERIC NOT NULL , GROUP_NAME NVARCHAR(80) DEFAULT NULL,' at line 1
The error you're encountering is likely due to the use of single quotes around the table name
Code:
GROUPS
and possibly the use of
Code:
NVARCHAR
and
Code:
NUMERIC
types, which are not directly used in MySQL the same way they might be in other SQL databases like SQL Server. In MySQL, you should use backticks to escape reserved words or special characters in table names and column names, and use equivalent data types that MySQL supports.Here's how you can correct the syntax for MySQL:
Code:
CREATE TABLE `GROUPS` (   `GROUP_ID` INT NOT NULL,   `GROUP_NAME` VARCHAR(80) DEFAULT NULL,   `CREATED` DATETIME DEFAULT NULL,   `CREATED_BY` VARCHAR(32) DEFAULT NULL,   `CHANGED` DATETIME DEFAULT NULL,   `CHANGED_BY` VARCHAR(32) DEFAULT NULL );

I corrected multiple errors on the same 

ALTER TABLE ACCESS_RIGHTS ADD CONSTRAINT FK_ACCESS_RIGHTS_GROUPS FOREIGN KEY ( GROUP_ID ) REFERENCES GROUPS ( GROUP_ID ) ON DELETE CASCADE ; Following Error happened: [MySQL][ODBC 8.3(w) Driver][mysqld-8.3.0]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUPS ( GROUP_ID ) ON DELETE CASCADE' at line 7

ChatGPT suggested code Fails
Code:
ALTER TABLE `ACCESS_RIGHTS` ADD CONSTRAINT `FK_ACCESS_RIGHTS_GROUPS` FOREIGN KEY (`GROUP_ID`) REFERENCES `GROUPS` (`GROUP_ID`) ON DELETE CASCADE;


ALTER TABLE `ACCESS_RIGHTS` ADD CONSTRAINT `FK_ACCESS_RIGHTS_GROUPS` FOREIGN KEY (`GROUP_ID`) REFERENCES `GROUPS` (`GROUP_ID`) ON DELETE CASCADE;
 
Last edit: 2 years 4 months ago by prashant.
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

More
2 years 4 months ago #23305 by Peter.Jonson

Please Log in or Create an account to join the conversation.

More
2 years 4 months ago #23313 by Peter.Jonson
It fails because GROUPS is a reserved word in the MySQL v 8

That was corrected in the latest release.

Please also look at the following article
www.etl-tools.com/wiki/knowledgebase/rep...ng-mysql-repository/  

Peter Jonson
ETL Developer
The following user(s) said Thank You: prashant

Please Log in or Create an account to join the conversation.

Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Marketing
Set of techniques which have for object the commercial strategy and in particular the market study.
Google
Accept
Decline
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Google Analytics
Accept
Decline
Functional
Tools used to give you more features when navigating on the website, this can include social sharing.
Advertisement
If you accept, the ads on the page will be adapted to your preferences.
Google Ad
Accept
Decline
Save