MD2012
MD2012

Reputation: 41

SSMA Migration error

I am doing migration from MYSQL to SQL SERVER. One of my table not migrated with reason as follows

 CREATE TABLE `user_tb` (`user_id` int(11) NOT NULL AUTO_INCREMENT, `username`    
 varchar(30) NOT NULL, `password` text NOT NULL,  `salt_id` varchar(20) NOT NULL,
 `emailid` varchar(50) NOT NULL, `gender` enum('male','female') DEFAULT NULL,  
 `country` int(5) DEFAULT NULL, `pincode` int(8) DEFAULT '0', `dob` date NOT NULL   
 DEFAULT '0000-00-00',

Column 'dob' does not allow DBNull.Value.

I am using SQL SERVER Migration Assistant (SSMA) Please suggest..

Upvotes: 1

Views: 1577

Answers (1)

Kasnady
Kasnady

Reputation: 2279

int(8) DEFAULT '0', dob date NOT NULL DEFAULT '1500-01-01', >> YYYY-MM-DD

You musn't write default value 0, but must 1. Cause your dob date NOT NULL this mean that it can't have NULL value, but cause of your default value is 0 and become 0000-00-00, so it just like NULL,, tried to change it to 1

Of course, date value would not have 00 as day and 00 as month or even the impossible 0000 as year. So try to set the year to default value as the minimum of years in your database. something like 2000 or what you like

Upvotes: 1

Related Questions