1

I have a table that have the following table structure

CREATE TABLE [dbo].[ASAT](
 [ID] [bigint] IDENTITY(1,1) NOT NULL,
 [ASATID] AS ('ASAT'+right('00000000000000000000'
 +CONVERT([varchar](19),[ID],0),(20))) PERSISTED NOT NULL,
 [Created] [nvarchar](8) NOT NULL DEFAULT (CONVERT([varchar],dateadd(year,
 (0),getdate()),(112)))
) ON [PRIMARY]

When I used the MySQL Migration Wizard to convert the above Microsoft database table structure, I got errors that both datatype for my fields ASATID and Created was not supported (in MySQL).

What are the recommended ways to proceed such data type differences when performing a database migration from SQL Server to MySQL?

Raj
7106 silver badges13 bronze badges
asked May 22, 2013 at 10:03

1 Answer 1

1

This answer will apply to your question : Insert Value based on One Column based on Value on another Column

AFAIK, and based on the link posted, you cannot create a computed column in MySQL. You should either:

  • Do the calculation outside of the database, when inserting OR
  • Create a trigger on the table to populate the value for you OR
  • Create a view to represent the data in the way you want.
answered May 22, 2013 at 10:32
2
  • MariaDB has computed columns. That might be another alternative. Commented Mar 19, 2014 at 3:47
  • Considering the computed column just seems to be for formatting, I'd go with a view. Commented Mar 19, 2014 at 14:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.