You can use cast or convert to convert string which is in yyyy/mm/dd (or) yyyy-mm-dd format to date.

Below is the script:
[sql]
–yyyy/mm/dd using cast
SELECT CAST(‘2000/12/30’ AS DATE)
–yyyy-mm-dd using cast
SELECT CAST(‘2000-12-30′ AS DATE)

–yyyy/mm/dd using cast
SELECT CONVERT(date,’2000/12/30′)
–yyyy-mm-dd using cast
SELECT CONVERT(date,’2000-12-30’)
[/sql]

Leave a Reply

Your email address will not be published. Required fields are marked *