Jump to content

Convert Date in SQL


Grace

Recommended Posts

Date is created as an INT type in the table. How can I convert it to a Date format (dd-mm-yyyy) in my select statement? It gives an error message  "conversion failed when converting date and/or time from character string".

Link to comment
Share on other sites

To change the data type of a column in a table, use the following syntax:

SQL Server / MS Access:

ALTER TABLE table_name
ALTER COLUMN column_name datatype;

My SQL / Oracle (prior version 10G):

ALTER TABLE table_name
MODIFY COLUMN column_name datatype;

For More information follow this link

https://www.w3schools.com/sql/sql_alter.asp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...