August 2, 2007 at 8:44 am
Hi,
Does anyone know how can I use an enumeration data type in SQL 2000?
It is known in MySQL where you ca define a table with enum data type like the following:
CREATE TABLE table1(
eid bigint not null,
eetypeenum('Employee', 'Partner', 'Customer', 'POS', 'Client', 'Server', 'Database', 'Other') not null,
)
Is there any possibility in MSSQL to define enums?
I am transforming MySQL scripts into MSSQL for a reason and need an advice.
Thank you
Cheers Ben
August 2, 2007 at 2:36 pm
Just found an article on comparing MySQL->MSSQL data types, stating that enum types don't exist in MSSQL,however there is the possibility to use the CHECK function, like the following:
CREATE TABLE table1(
eid bigint not null,
eetype varchar
CHECK(eetype in('Employee',
'Partner',
'Customer',
'POS',
'Client',
'Server',
'Database',
'Other')
) not null;
Ben
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply