Quantcast
Channel: Toad for MySQL
Viewing all articles
Browse latest Browse all 1315

Forum Post: Importing CSV files ignores unique index

$
0
0
I am importing a CSV file that has roughly 12 columns and a little under 200 rows, so nothing large. It's my first time using the Import tool under TOAD and although it seems to work fine it also seems to completely ignore NOT NULL constraints and UNIQUE INDEX. For example, I have a table defined as follows: CREATE TABLE `addresses_stg` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `cust_email` varchar(255) NOT NULL,   `name` varchar(255) NOT NULL,   `line1` varchar(255) NOT NULL,   `line2` varchar(255) DEFAULT NULL,   `city` varchar(255) NOT NULL,   `county` varchar(255) NOT NULL,   `state` varchar(255) NOT NULL,   `zip` int(11) NOT NULL,   `billing` varchar(255) DEFAULT NULL,   `delivery` varchar(255) DEFAULT NULL,   `addr_notes` text,   `error_msg` text,   PRIMARY KEY (`id`)   ) ENGINE=InnoDB DEFAULT CHARSET=latin1;   CREATE UNIQUE INDEX cust_addr_u1 on addresses_stg (cust_email,name,line1,line2,city,county,state,zip); Based on the above, rows that have null email addresses or that are not unique across cust_mail, name, line1, line2, city, county, state and zip sould NOT load at all.  But they do.  Why is that?  What is the point of having a NOT NULL constraint and/or unique index if the import ignores them?  Is this normal behavior?

Viewing all articles
Browse latest Browse all 1315

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>