Recently, I was trying to convert a date to a specific format in SQL Server using the to_date function. But after executing the SQL query, I got this error.
‘to_date’ is not a recognized built-in function name.
I was trying to execute the following query.
SELECT to_date('20250526','YYYY-MM-DD');After executing the above query, I got this error as shown in the screenshot below.

Solution
The problem here is that I was trying to use the to_date function in SQL, but actually, it is not available in SQL Server. It is available in Oracle, PostgreSQL, and other databases.
To do the same job in SQL Server, we can use the CONVERT() Function or CAST().
I have now executed the query below to achieve this.
SELECT CONVERT(DATE, '20250526', 112) AS ConvertedDate;After executing the above query, I got the expected output as shown in the screenshot below.

Video Tutorial
You may also like the following articles.
- ‘EXTRACT’ is not a recognized built-in function name.
- The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
- Operand Type Clash: Date Is Incompatible With Int
- The datepart hour is not supported by date function dateadd for data type date.
After working for more than 15 years in the Software field, especially in Microsoft technologies, I have decided to share my expert knowledge of SQL Server. Check out all the SQL Server and related database tutorials I have shared here. Most of the readers are from countries like the United States of America, the United Kingdom, New Zealand, Australia, Canada, etc. I am also a Microsoft MVP. Check out more here.