
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Does SQL Server have an equivalent to MySQL's ENUM data type?
This works in MySQL version 8.0.12. The syntax is as follows.
create table yourTableName ( yourColumnName enum(‘Value1’,Value2’,Value3’,......N) default Value1’ or Value2 or Value3,..N );
Set the enum type in MySQL with the following query.
mysql> create table EnumInMySQL -> ( -> WebCRUD enum('CREATE','READ','UPDATE','DELETE') -> default 'CREATE' -> ); Query OK, 0 rows affected (0.60 sec)
The syntax of enum in SQL Server.
create table yourTableName ( yourColumnName varchar(100) CHECK(yourColumnName IN (‘Value1’,Value2’,Value3’,......N)) DEFAULT ‘Value1’ or Value2’ or Value3’,......N );
Now the query is as follows for enum in SQL Server.
- Related Articles
- MySQL LIMIT clause equivalent for SQL SERVER?
- Equivalent of SQL Server IDENTITY Column in MySQL?
- What is the C# Equivalent of SQL Server DataTypes?
- The equivalent of SQL Server function SCOPE_IDENTITY() in MySQL?
- What is MySQL ENUM data type? What are the advantages to use ENUM data type?
- Data Replication from SAP PO to SQL Server
- Using SSIS to load data from SQL Server to SAP BW
- How to enumerate an enum with String type?
- SQL Query to Convert Rows to Columns in SQL Server
- How to define an enumerated type (enum) in C++?
- How to Rename SQL Server Schema?
- what are the different attributes of MySQL ENUM data type?
- The equals and == operator for Enum data type in Java
- Add a new value to a column of data type enum in MySQL?
- How can I insert default value in MySQL ENUM data type?

Advertisements