0

Currently my database is in MS SQL. I have table with 100k records. this table has a column which is primary key, auto incremented as GUID. Recently I migrated the data to MySQL (using workbench) and it was all successful but when I try to insert any data it fails. I found that the column 'Id' was migrated as Varchar(36) and hence the rows are not getting incremented.

What is the best solution to overcome issue? This is a sample of just one table and I have around table with the same issue.

Dheeraj Mutha
  • 79
  • 1
  • 1
  • 8
  • Use `NOT NULL DEFAULD (UUID())` for this column. – Akina Dec 08 '20 at 05:20
  • Will this work? CREATE TABLE IF NOT EXISTS `ISP`.`StageConfigurationAudit` ( `Id` CHAR(36) PRIMARY KEY NOT NULL DEFAULT uuid(), `CreatedBy` VARCHAR(200) CHARACTER SET 'utf8mb4' NULL); – Dheeraj Mutha Dec 08 '20 at 05:41
  • You are not careful. Default value expression MUST be enclosed with parenthesis. https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=c13474906e9fa281a74f002e4a78d827 – Akina Dec 08 '20 at 05:52
  • Thanks. I am trying that right now and will update you. – Dheeraj Mutha Dec 08 '20 at 06:21

0 Answers0