[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Field 'BIOMETRIC_FLAG' doesn't have a default value

Posted on 2008-11-17
6
Medium Priority
?
322 Views
Last Modified: 2012-05-05
Hi,
i am trying to insert data into a table but i am getting this error.
Field 'BIOMETRIC_FLAG' doesn't have a default value
INSERT INTO mytab (CLIENT_ID,DAD_ID,LOCATION,DESCRIPTION) VALUES (1,1,'Default','First Data Acquisition Device');
where 'BIOMETRIC_FLAG'  is a field in the table and it is defined in the table as
BIOMETRIC_FLAG                CHAR(1)                           NULL
please help me in resolvin this error.
rgds,
vijji
0
Comment
Question by:vijji_lakshmi
  • 3
  • 3
6 Comments
 
LVL 26

Expert Comment

by:Umesh
ID: 22974165
You provided values for 4 columns. But column 'BIOMETRIC_FLAG' MUST be filled in because you have no default set for it. Otherwise what is MySQL supposed to fill 'BIOMETRIC_FLAG' with?

Please post the output of below..

desc mytab;
0
 

Author Comment

by:vijji_lakshmi
ID: 22974205
Hi, i mentioned in table def that BIOMETRIC_FLAG  can be null.
if i don't supply any thing i suppose it should keep null or blank.
any way ia have provided deble strusture below.
please let me know the solution.

+-------------------+-------------+------+-----+---------+-------+
| Field             | Type        | Null | Key | Default | Extra |
+-------------------+-------------+------+-----+---------+-------+
| CLIENT_ID         | int(11)     | NO   |     |         |       |
| DAD_ID            | int(11)     | NO   |     |         |       |
| LOCATION          | varchar(20) | YES  |     | NULL    |       |
| DESCRIPTION       | varchar(40) | YES  |     | NULL    |       |
| NAME              | varchar(20) | YES  |     | NULL    |       |
| CONNECTION_TYPE   | int(11)     | YES  |     | NULL    |       |
| PRIMARY_ADDRESS   | varchar(50) | YES  |     | NULL    |       |
| SECONDARY_ADDRESS | varchar(50) | YES  |     | NULL    |       |
| TERTIARY_ADDRESS  | varchar(50) | YES  |     | NULL    |       |
| BIOMETRIC_FLAG    | char(1)     | YES  |     | NULL    |       |
| TIME_ZONE         | varchar(50) | YES  |     | NULL    |       |
| DAYLIGHT          | char(1)     | YES  |     | NULL    |       |
+-------------------+-------------+------+-----+---------+-------+
0
 
LVL 26

Expert Comment

by:Umesh
ID: 22974229
Pls send this..

show create table mytab;

and

show variables like 'sql_mode';
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

Author Comment

by:vijji_lakshmi
ID: 22974250
| dad_m | CREATE TABLE `mytab` (
  `CLIENT_ID` int(11) NOT NULL,
  `ID` int(11) NOT NULL,
  `LOCATION` varchar(20) DEFAULT NULL,
  `DESCRIPTION` varchar(40) DEFAULT NULL,
  `NAME` varchar(20) DEFAULT NULL,
  `CONNECTION_TYPE` int(11) DEFAULT NULL,
  `PRIMARY_ADDRESS` varchar(50) DEFAULT NUL
  `SECONDARY_ADDRESS` varchar(50) DEFAULT N
  `TERTIARY_ADDRESS` varchar(50) DEFAULT NU
  `BIOMETRIC_FLAG` char(1),
  `TIME_ZONE` varchar(50) DEFAULT NULL,
  `DAYLIGHT` char(1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
0
 

Author Comment

by:vijji_lakshmi
ID: 22974253
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| sql_mode      |       |
+---------------+-------+
0
 
LVL 26

Accepted Solution

by:
Umesh earned 1500 total points
ID: 22974325
This works..


CREATE TABLE `mytab` (
  `CLIENT_ID` int(11) NOT NULL,
  `DAD_ID` int(11) NOT NULL,
  `LOCATION` varchar(20) DEFAULT NULL,
  `DESCRIPTION` varchar(40) DEFAULT NULL,
  `NAME` varchar(20) DEFAULT NULL,
  `CONNECTION_TYPE` int(11) DEFAULT NULL,
  `PRIMARY_ADDRESS` varchar(50) DEFAULT NULL,
  `SECONDARY_ADDRESS` varchar(50) DEFAULT NULL,
  `TERTIARY_ADDRESS` varchar(50) DEFAULT NULL,
  `BIOMETRIC_FLAG` char(1),
  `TIME_ZONE` varchar(50) DEFAULT NULL,
  `DAYLIGHT` char(1)
)
 
INSERT INTO mytab (CLIENT_ID,DAD_ID,LOCATION,DESCRIPTION) VALUES (1,1,'Default','First Data Acquisition Device');
 
 
SELECT * from mytab;
 
1		1		Default		First Data Acquisition Device		\N		\N		\N		

Open in new window

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question