Hendro,
In SQL an empty string is not null.
PB
Hendro Suryawan wrote:
Hi all,
I have table with primary key on field PO,BrgId, NOSP but when i try
insert several new reccord with field NOSP = '', mysql will accept the
new reccord without complaint error.
Is this normal behavior? My perception if i have primary key on the
three field the three field must be not empty. I try to alter the field
NOSP with syntax :
Alter table BrgIn2 Change NOSP NOSP Varchar(20) NOT NULL
but if i looked table definition mysql always add default '' in the
definition. How to tell mysql not to add default '', i want to this
field always not null or ''. I use mysql 4.1.11 on FC3 X86_64.
Can anyone help? Thanks in advance.
regards,
Hendro
Table Create Table
------ ----------------------------------------------------
BrgIn2 CREATE TABLE `BrgIn2` (
`PO` varchar(17) NOT NULL default '',
`BrgId` int(4) NOT NULL default '0',
`NoSP` varchar(20) NOT NULL default '',
`Spesifikasi` varchar(100) default NULL,
`Qty` decimal(10,3) NOT NULL default '0.000',
`Price` decimal(19,4) NOT NULL default '0.0000',
`Disc` decimal(6,4) default NULL,
`DPP` decimal(10,4) default NULL,
`Tax` decimal(6,4) default '0.0000',
`pph` decimal(6,4) default '0.0000',
`Kurs` decimal(10,4) default NULL,
`ShipDate` date default NULL,
`Currcy` varchar(10) NOT NULL default '',
`Keterangan` blob,
`Terima` decimal(9,2) default NULL,
`Periode` varchar(7) default NULL,
`TglInput` date default NULL,
`Operators` varchar(50) default NULL,
`Workstation` varchar(30) default NULL,
PRIMARY KEY (`PO`,`BrgId`,`NoSP`),
KEY `BrgIn2SPBrg` (`NoSP`,`BrgId`,`Qty`),
KEY `BrgId` (`BrgId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.7.6/19 - Release Date: 6/16/2005
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]