Link to home
Avatar of emi_sastra
emi_sastra

asked on

UDDT and UID at MySQL

Dear All,

I use MS SQL and usually create User Defined Data Types and UID.
Could I do it using MySQL ?

Thank you.
Avatar of Bill Prew
Bill Prew

There is no support in MySQL for User Defined Data Types.

I don't believe there is a data type for UID's either, but there is one or more functions related to generating UID's as I recall (have been working mostly in MS SQL Server lately).


»bp
Avatar of emi_sastra

ASKER

Hi Bill,

I am sorry, i think I had response to this question.

Is there any substitution for it/

Thank you.
About all you can do for custom data types is include as many columns as you need using the supported datatypes in MySQL to store the same data you would have stored in a custom data type.  Sometimes you can just format it into a varchar, other times you may want to use multiple columns.


»bp
Please provide sample of datatype in MySQL that could replace UDDT and UID

Thank you.
A UDDT in Sql Server is just an alias for an existing data type.  So for example we could have:

Create Type SSN from varchar(11) NOT NULL

To store something like '123-45-6789'

In MySQL you would just have to use varchar(11) since you can't define a UDDT in MySQL.

Not sure what you are meaning by UID, can you be more specific?


»bp
UID = UniqueIdentifier.

Thank you.
uniqueidentifier  in SQL Server is a 16 character string, so I would use varchar(16) to store that in MySQL.


»bp
I know the length of UID.
What I want to find out is similar type to MS SQL, where it create automatically by using NewID()

Is there auto generated ID in MySQL?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Hi Bill,

Thank you very much for your help.