Error 1364 Hy000 Mysql
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack sqlstate hy000 general error 1364 Overflow the company Business Learn more about hiring developers or posting ads with us sqlstate hy000 general error 1364 field doesn't have a default value Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a
Sql Error 1364 Sqlstate Hy000
community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ERROR 1364 (HY000): Field 'MY_DATE' doesn't have a default value up vote 0 down vote
Error Hy000 Mysql Odbc 5.1 Driver Access Denied For User
favorite 1 create table MYTABLE { MY_DATE int NOT NULL AUTO_INCREMENT, NAME varchar(255) NOT NULL UNIQUE }; INSERT INTO MYTABLE(NAME)values(jessica); Why do I get this error? ERROR 1364 (HY000): Field 'MY_DATE' doesn't have a default value sql mysql mysql-error-1364 share|improve this question edited Jan 2 '14 at 17:57 JYelton 19.9k1376152 asked Feb 15 '11 at 6:30 garima 2,30152963 2 (1) Don't call it my_date if it's an int, that's just error 2002 hy000 mysql asking for trouble. (2) Don't you need quotes around jessica? –paxdiablo Feb 15 '11 at 6:34 (3) autoincrement column should also declared as a key –Shakti Singh Feb 15 '11 at 6:36 @Ciaran Keating: Look at below answer –Shakti Singh Feb 15 '11 at 6:47 @Shakti: Yes, I wrote that comment too hastily. Sorry. –Ciaran Keating Feb 15 '11 at 6:53 add a comment| 3 Answers 3 active oldest votes up vote 3 down vote accepted From the docs: There can be only one AUTO_INCREMENT column per table, it must be indexed, and it cannot have a DEFAULT value. I think you'll find that, because you're not indexing MY_DATE, it may be silently ignoring the AUTO_INCREMENT option (I can't guarantee that, it's just supposition, but the note in the documentation is still relevant). All the samples I can see on the AUTO_INCREMENT stuff have (the equivalent of): PRIMARY KEY (MY_DATE) Alternatively, you may be running in strict SQL mode. All the docs I've seen seem to indicate that, in the absence of a specific default, unlisted columns in an insert will get NULL if they're nullable, or the type default if the not nullable: If you are not running in strict SQL mode, any colum
here for a quick overview of the site Help Center Detailed answers to any questions you
Error 2002 Hy000 Mysql Centos
might have Meta Discuss the workings and policies of this site error 2006 hy000 mysql About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or error 1215 hy000 mysql posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of http://stackoverflow.com/questions/5000547/error-1364-hy000-field-my-date-doesnt-have-a-default-value 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up SQL error: 1364 Field 'XXXX' doesn't have a default value up vote 2 down vote favorite So I have, table courses: CREATE TABLE IF NOT EXISTS `AppDziennik`.`courses` ( `id_course` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(80) NOT http://stackoverflow.com/questions/18316451/sql-error-1364-field-xxxx-doesnt-have-a-default-value NULL , `teachers_id_teacher` INT NOT NULL , `end_date` DATE NULL , `about` VARCHAR(255) NULL , `start_date` DATE NULL , PRIMARY KEY (`id_course`) , UNIQUE INDEX `id_course_UNIQUE` (`id_course` ASC) , CONSTRAINT `fk_courses_teachers1` FOREIGN KEY (`teachers_id_teacher` ) REFERENCES `AppDziennik`.`teachers` (`id_teacher` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB and second table CREATE TABLE IF NOT EXISTS `AppDziennik`.`teachers` ( `id_teacher` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , `surname` VARCHAR(45) NOT NULL , `about` VARCHAR(255) NULL , `id_class` INT NULL , `rank` VARCHAR(45) NULL , `logins_id_login` INT NOT NULL , PRIMARY KEY (`id_teacher`) , INDEX `fk_teachers_classes1_idx` (`id_class` ASC) , INDEX `fk_teachers_logins1_idx` (`logins_id_login` ASC) , CONSTRAINT `fk_teachers_classes1` FOREIGN KEY (`id_class` ) REFERENCES `AppDziennik`.`classes` (`id_class` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_teachers_logins1` FOREIGN KEY (`logins_id_login` ) REFERENCES `AppDziennik`.`logins` (`id_login` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB When I make that insert insert into appdziennik.courses (name, id_teacher, about, start_date, end_date) values ("Math",'7',"Math",'201
a default value" does not take into account triggers Summary: "Field doesn't have a default https://netbeans.org/bugzilla/show_bug.cgi?id=190731 value" does not take into account triggers Status: RESOLVED WONTFIX Product: db Classification: Unclassified Component: MySQL Version: 6.x Hardware: PC Linux Priority: P3 (vote) TargetMilestone: 7.0 Assigned To: Jiri Rechtacek QA Contact: issues@db URL: Whiteboard: Keywords: Depends on: Blocks: Show dependency tree /graph Reported: 2010-10-03 19:55 UTC by hubbitus Modified: 2010-12-13 18:40 UTC (History) CC List: 0 hy000 mysql users See Also: Issue Type: DEFECT Exception Report : Attachments Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description hubbitus 2010-10-03 19:55:56 UTC I try debug my SQL for MySQL, but got error similar: "Error code 1364, SQL state HY000: Field '_lft' doesn't sqlstate hy000 general have a default value" Yes, '_lft' doesn't have a default value, but it is not problem - it is computed in triggers (automatic Nested Sets implementation). Console native mysql client does not complain about it and execute query perfectly. Comment 1 Jiri Rechtacek 2010-11-26 08:45:17 UTC Could you describe your use-case? DDL of the table (incl. trigger declaration) and SQL command for inserting values (or screen shot of Insert values dialog). It'll help to evaluate this problem. Thanks Comment 2 hubbitus 2010-11-26 10:19:59 UTC Use case is very simple as INSERT INTO tablename set field1 = 'fieldvalue'; Statement was rejected from Netbeans IDE with error what listed not all fields which have not default values. But it is not always problem if such fields will populated in trigger (in any case). Console MySQL client already inserted such lines. Comment 3 Jiri Rechtacek 2010-11-26 10:31:52 UTC Bug description is not enough for me. Describe in detail by me previous comment (DDL table, SQL statemnt, trigger declaration). Comment 4 hubbitus 2010-12-13 09:35:56 UTC Ok, full reproduce: DDL: DROP TA