Modify Data Type with ALTER Command

Modify Data Type with ALTER Command

Is it possible to modify the Data type of a column which has at least one data in it?If it is possible,then what will happen to the data in the column?

Example. Table Name: Emp

EmpName | Salary

Smith | 10000

The above table is with 'Char' as datatype for the column 'EmpName' and 'INT' for column 'Salary'

ALTER TABLE Emp ALTER COLUMN EmpName INT;

Is it possible to modify the above table like this?If this is a valid query, then what will happen to the data 'Smith'?

View Answers

January 12, 2012 at 5:07 PM

Use the following query:

ALTER TABLE Emp MODIFY EmpName int(255);









Related Tutorials/Questions & Answers:
Modify Data Type with ALTER Command
Modify Data Type with ALTER Command  Is it possible to modify the Data type of a column which has at least one data in it?If it is possible,then what... the following query: ALTER TABLE Emp MODIFY EmpName int(255
alter data type
alter data type  alter data type of subName column for subject table to varchar(40
Advertisements
Mysql Alter Data Type
Mysql Alter Data Type       Mysql  Alter Date Type is used to modify or change the Column... cover an example on 'Mysql Alter Date Type'.To understand this example we
Mysql Alter Data Type
Mysql Alter Data Type       Mysql  Alter Date Type is used to modify or change the Column... an example on 'Mysql Alter Date Type'.To understand this example we create a table
SQL Alter Column Size
to change the size of data type of your field. In this case, we modify the size... is used to modify the data type size.Again,Describe Table show you the modified...; Alter Column Size modify the Column Size. The SQL Alter Column Size
SQL Alter Column type
alter the table 'stu_Table' and MODIFY keywords modify the data type of Stu... SQL Alter Column type       Alter Column type in SQL is used to change or recreate the data type
Mysql Alter Command
. ALTER TABLE table name modify column name type; Renaming... Mysql Alter Command       Mysql Alter Command define the list of Command used for removing
SQL Alter Column type
SQL Alter Column type       Alter Column type in SQL is used to change or recreate the data type...' and MODIFY keywords modify the data type of Stu_Id(varchar (2)) into Stu_Id( int(3
how to store,retrieve,modify the data
how to store,retrieve,modify the data  hello sir ,how to store,retrieve,modify the data using the swing please help me
data type
data type  which data type is used to store video file in mysql databse
Mysql Alter Procedure
that is executed under one name. Mysql Alter Procedure is used to modify and redefine... to alter procedure from Security_type status i.e DEFINER to  INVOKER:ADS... Mysql Alter Procedure     
Mysql Alter Procedure
that is executed under one name. Mysql Alter Procedure is used to modify... to alter procedure from Security_type status i.e DEFINER to  INVOKER:ADS... Mysql Alter Procedure     
SQL Alter Column Name
SQL Alter Column Name       Alter Column Name in SQL is used to change or modify the name of column... you a simple example on SQL Alter Column Name. In this Example, create
Mysql Alter Column Datatype
) Query to alter column data type of the Table named employees: The Alter Query redefine the table 'employee' and change the data type...;    Mysql Alter Column Datatype is used to modify the table
data type
data type  what are the date types in the java and vb.net? what is the difference between java and vb.net?   Hi Friend, java data types... vb.net data types are: Byte SByte Short UShort Integer UInteger Long ULong
Is it modify Object data? Generally Object data can't modify............but in this program it modifies.......... Why?
Is it modify Object data? Generally Object data can't modify............but in this program it modifies.......... Why?   import java.io.*; public...); System.out.println("Object data is modified
Mysql Alter Autoincrement
; Mysql Alter Autoincrement is used to modify the definition of ... | +-------+---------+------------+ 2 rows in set (0.00 sec) Query to view data type of Table named... named employees: The Alter Query below is used to modify table 'employees
SERIAL data type
SERIAL data type   hello, What is SERIAL data type in MySQL?   hii,ADS_TO_REPLACE_1 SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
Mysql Alter Rename Table
Mysql Alter Rename Table       Mysql Alter Rename Table is used to modify and change the name..._TO_REPLACE_5 The given below query  Alter statement is used to modify table
SQL Alter Database
SQL Alter Database       SQL Alter Database is used to modify the structure of existing database... 'SQL Alter Database'. To grasp the example we create a database 'komal' using
Mysql Alter Add Multiple Columns
Mysql Alter Add Multiple Columns       Mysql Alter Add Multiple Columns is used to modify...' that include the required field name and data type. The table has a Empid as primary
Mysql Alter Drop
Mysql Alter Drop       Mysql Alter Drop is used to modify the table definition and delete... employees using alter command :ADS_TO_REPLACE_5 The alter Query modifies
SQL Alter Table
SQL Alter Table       SQL Alter Table is used to modify the existing table definition...; Query Alter given below is used to modify the existing table 'Stu' and add id
Enum data type
Enum data type  How can we use enum data type in java program?  ... data type. Here we have defined Fruits as enum type by using the enum keyword. Now... data type. Here we have defined Fruits as enum type by using the enum keyword. Now
Mysql Alter Column
Mysql Alter Column       Mysql Alter Column is used to modify table and  change... create a table 'employee1 ' with the required field name and data type
Mysql Alter Column Size
;  Mysql Alter Column Size is used to change the data size... | +-------+---------+------------+ 2 rows in set (0.00 sec) Data type of Table... the table field ,data type,Null ,key ,default  etc properties
Mysql Alter Column Primary Key
Mysql Alter Column Primary Key       Mysql Alter Column Primary Key is used to modify table..._TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Alter Column Primary
Mysql Alter Column Default
;  Mysql Alter Column Default is used to modify the table... column to set default: The Query Alter is used to modify table 'usertable' and add the column default value to Null. ALTER table usertable Modify last
Data Conversion from int to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from int primitive type to another data type like String, boolean and char etc
Data Conversion from String to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from String primitive type to another data type like int, boolean and char etc
Data Conversion from short to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from short primitive type to another data type like String, boolean and char etc
Data Conversion from byte to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from byte primitive type to another data type like String, boolean and char etc
Data Conversion from float to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from float primitive type to another data type like String, boolean and char etc
Data Conversion from double to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from double primitive type to another data type like String, boolean and char etc
Data Conversion from long to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from long primitive type to another data type like String, boolean and char etc
MySQL Boolean Data Type
MySQL Boolean Data Type This example illustrates how create a boolean data type. In this example we create a table 't' where define four field that is 'a' which is BOOL type, 'b' which is FLOAT type, 'c' which is LONG VARCHAR type
Mysql Alter Rename Column
Mysql Alter Rename Column       Mysql Alter Rename Column is used to modify the table..._TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Alter Rename Column
ModuleNotFoundError: No module named 'data_type_tools'
python with following command: pip install data_type_tools After...ModuleNotFoundError: No module named 'data_type_tools'  Hi, My... named 'data_type_tools' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'algebraic-data-type'
algebraic-data-type python with following command: pip install algebraic-data...ModuleNotFoundError: No module named 'algebraic-data-type'  Hi, My... named 'algebraic-data-type' How to remove the ModuleNotFoundError
ModuleNotFoundError: No module named 'data_type_tools'
python with following command: pip install data_type_tools After...ModuleNotFoundError: No module named 'data_type_tools'  Hi, My... named 'data_type_tools' How to remove the ModuleNotFoundError: No module named
SQL Alter Table Name
SQL Alter Table Name       SQL Alter Table Name is used to change or modify  name... want to change the name of Table 'Stu_Table' to 'Stu_Tab_10'. The Alter
SQL Alter Column
The SQL ALTER Syntax is used to modify the table and add a column name that you want to add and its data type. ALTER TABLE...' with field attribute and data type specified in Query respectively. 
Data type in java
Data type in java In this section we will tell you about data type in java. A data type is defined as " type of data that can be stored... of variable. By declaring the type of data, compiler restrict the user from
Mysql Alter Allow Null
; Mysql Alter Allow Null is used to change the Null Type of a column... The Alter Query is used to modify or change the 'usertable ' definition..._TO_REPLACE_5 ALTER table usertable Modify last_name varchar(50) null
array accept all data type
array accept all data type  how can create array that accept all data type??? if we can solution it? how..   Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public
array accept all data type
array accept all data type  how can create array that accept all data type??? if we can solution it? how..   Hi Friend, Try the following code: import java.lang.reflect.*; class CreateArrayOfAllTypes{ public
PHP Integer Data Type
Learn PHP Integer Data type: In PHP integers can be decimal which is a normal... size of the integer data type is platform dependent. Usually the size of integer... be converted to float data type. PHP Integer Data Type Example:ADS_TO_REPLACE_2 <
Mysql Alter Multiple Columns
Mysql Alter Multiple Columns       Mysql Alter Multiple Columns is used to modify the table..._TO_REPLACE_1 The Tutorial illustrate an example from 'Mysql Alter Multiple
SQL Alter Column Name
SQL Alter Column Name       Alter Column Name in SQL is used to change or modify the name... new_column_name type size Query The Alter Table alter
SQL Alter Column
The SQL ALTER Syntax is used to modify the table and add a column name that you want to add and its data type. ALTER..._Table' with field attribute and data type specified in Query respectively

Ads