Answers for "convert data type in sql server"

SQL
1

convert data type in sql

# There are two ways to change data type. By using CAST or ::
# Eg. CAST (column_name AS target_type) OR column_name::target_type

SELECT
	CAST (date_occurred AS DATE)
    CAST (total_amount AS INTEGER)
    CAST (duration AS INTERVAL)
# OR    
    date_occurred::DATE
    total_amount::INTEGER
    duration::INTERVAL
Posted by: Guest on August-03-2021
6

sql server convert string to date

Cast( '2011-07-07' as date ) as convertedDate
Posted by: Guest on April-06-2020

Code answers related to "convert data type in sql server"

Code answers related to "SQL"

Browse Popular Code Answers by Language