0
votes
  • SQLSTATE[42000]: Syntax error or access violation: 1064 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 '1 NOT NULL, default_value VARCHAR(255), is_encrypted TINYINT(1) NOT NULL, is_met' at line 1.

Failing Query:

"CREATE TABLE ohrm_display_field (report_group_id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL, field_alias VARCHAR(255), is_sortable VARCHAR(10) NOT NULL, sort_order VARCHAR(255), sort_field VARCHAR(255), element_type VARCHAR(255) NOT NULL, element_property TEXT NOT NULL, width VARCHAR(255) NOT NULL, is_exportable VARCHAR(10), text_alignment_style VARCHAR(20), is_value_list TINYINT(1) NOT NULL, display_field_group_id 1 NOT NULL, default_value VARCHAR(255), is_encrypted TINYINT(1) NOT NULL, is_meta TINYINT(1) DEFAULT '0' NOT NULL, display_field_id BIGINT AUTO_INCREMENT, PRIMARY KEY(display_field_id)) ENGINE = INNODB"

[Solved]

Next Error:

  • SQLSTATE[42000]: Syntax error or access violation: 1064 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 ' PRIMARY KEY(id)) ENGINE = INNODB' at line 1.

    Failing Query:

    "CREATE TABLE ohrm_job_interview_attachment (id BIGINT, interview_id BIGINT, file_name VARCHAR(255), file_type VARCHAR(255), file_size BIGINT, file_content LONGBLOB, attachment_type INT, comment , PRIMARY KEY(id)) ENGINE = INNODB"

Can anyone suggest what's the error in the indicated query? Any effective guidance will be highly appreciated.

1
Can you give us your code?Ballantine
Format your SQL pleaseJohn Conde
Please consider a new question for your new problem, but your column comment lacks a type. If you write nicely formatted code you will see such problems at once.VMai
It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for at least one of your questions.Mr. Llama

1 Answers

0
votes

The issue is here

display_field_group_id 1 NOT NULL, 

You need to assign some data type if its tinyint then the following should work

CREATE TABLE ohrm_display_field 
(
report_group_id BIGINT NOT NULL, 
name VARCHAR(255) NOT NULL, 
label VARCHAR(255) NOT NULL, 
field_alias VARCHAR(255), 
is_sortable VARCHAR(10) NOT NULL, 
sort_order VARCHAR(255), 
sort_field VARCHAR(255), 
element_type VARCHAR(255) NOT NULL, 
element_property TEXT NOT NULL,
 width VARCHAR(255) NOT NULL, 
is_exportable VARCHAR(10), 
text_alignment_style VARCHAR(20), 
is_value_list TINYINT(1) NOT NULL, 
display_field_group_id TINYINT(1) NOT NULL, 
default_value VARCHAR(255), 
is_encrypted TINYINT(1) NOT NULL, 
is_meta TINYINT(1) DEFAULT '0' NOT NULL,
display_field_id BIGINT AUTO_INCREMENT, 
PRIMARY KEY(display_field_id)
) ENGINE = INNODB