Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL Modify Data Type with ALTER Command
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Alice Paul
Modify Data Type with ALTER Command
1 Answer(s)      2 years and 8 months ago
Posted in : SQL


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'?


Advertisement
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... on 'Mysql Alter Date Type'.To understand this example we create a table
Mysql Alter Data Type
Mysql Alter Data Type       Mysql  Alter Date Type is used to modify or change the Column... Alter Date Type'.To understand this example we create a table 'userform
SQL Alter Column Size
of data type of your field. In this case, we modify the size of Stu_Id,whose...; Alter Column Size modify the Column Size. The SQL Alter Column Size is used when you want to change the data type size. Understand
Mysql Alter Command
Mysql Alter Command       Mysql Alter Command define the list of Command used for removing... with Example The Tutorial illustrate an example from 'Mysql Alter Command
SQL Alter Column type
SQL Alter Column type       Alter Column type in SQL is used to change or recreate the data type... keywords modify the data type of Stu_Id(varchar (2)) into Stu_Id( int(3)). 
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
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... (0.00 sec) Query to alter procedure from Security_type status i.e DEFINER to ... Mysql Alter Procedure     
Mysql Alter Procedure
that is executed under one name. Mysql Alter Procedure is used to modify and redefine... (0.00 sec) Query to alter procedure from Security_type status i.e DEFINER... Mysql Alter Procedure     
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
SQL Alter Column Name
SQL Alter Column Name       Alter Column Name in SQL is used to change or modify the name of column..._name type size Query The Alter Table alter the table 'Stu
Mysql Alter Column Datatype
in set (0.02 sec) Query to alter column data type of the Table named...;    Mysql Alter Column Datatype is used to modify the table... | +-------+---------+------------+ 2 rows in set (0.00 sec) Data type of Table
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
SQL Alter Database
SQL Alter Database       SQL Alter Database is used to modify the structure of existing database. Understand with Example The Tutorial illustrate an example from 'SQL Alter Database
Mysql Alter Rename Table
Mysql Alter Rename Table       Mysql Alter Rename Table is used to modify and change the name... name: The given below query  Alter statement is used to modify table
Mysql Alter Drop
Mysql Alter Drop       Mysql Alter Drop is used to modify the table definition and delete... Table named employees using alter command : The alter Query modifies
SERIAL data type
SERIAL data type   hello, What is SERIAL data type in MySQL?   hii, SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE
Mysql Alter Autoincrement
; Mysql Alter Autoincrement is used to modify the definition of ... to view data type of Table named employees: The Query below is used to describe... key of the Table named employees: The Alter Query below is used to modify table
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 Add Multiple Columns
Mysql Alter Add Multiple Columns       Mysql Alter Add Multiple Columns is used to modify... the required field name and data type. The table has a Empid as primary key.  
SQL Alter Table
SQL Alter Table       SQL Alter Table is used to modify the existing table definition... Primary Key: The  Query Alter given below is used to modify the existing table
Mysql Alter Column
Mysql Alter Column       Mysql Alter Column is used to modify table and  change... 'employee1 ' with the required field name and data type respectively.  
Mysql Alter Column Default
;  Mysql Alter Column Default is used to modify the table... Alter is used to modify table 'usertable' and add the column default value to Null. ALTER table usertable Modify last_name varchar(50) null
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
Mysql Alter Column Primary Key
Mysql Alter Column Primary Key       Mysql Alter Column Primary Key is used to modify table... The Tutorial illustrate an example from 'Mysql Alter Column Primary Key
Mysql Alter Column Size
;  Mysql Alter Column Size is used to change the data size... the table field ,data type,Null ,key ,default  etc properties... named employees: The Query Alter is used to modify the definition of table
Mysql Alter Rename Column
Mysql Alter Rename Column       Mysql Alter Rename Column is used to modify the table... The Tutorial illustrate an example from 'Mysql Alter Rename Column'. To understand
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
Advertisements
 

 

 

DMCA.com