About 3,390,000 results
Open links in new tab
  1. CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Learn

    This example displays a date and time as character data, uses CAST to change the character data to the datetime data type, and then uses CONVERT to change the character data to the …

  2. sql - datetime Cast or Convert? - Stack Overflow

    Jul 2, 2013 · Using CAST and CONVERT with datetime data. The following example displays the current date and time, uses CAST to change the current date and time to a character data …

  3. Examples for SQL CAST and SQL CONVERT Functions - SQL

    Sep 16, 2021 · Learn how to convert SQL Server data to different data types such as string, date, integer and numeric using the CAST and CONVERT functions.

  4. SQL Convert String to Date Functions: CAST() and TO_DATE() - SQL

    SQL provides a CAST() function that allows you to convert a string to a date. The following illustrates the syntax of the CAST() function: Code language: SQL (Structured Query …

  5. How to Convert a String to a Date/Time in SQL Server using CAST()

    Jun 5, 2018 · So if you need to convert a string to a date/time value, you can use the CONVERT() function or the CAST() function. And if you get an error while using those two functions, the …

  6. SQL Server CAST() Function - W3Schools

    Aug 25, 2017 · The CAST () function converts a value (of any type) into a specified datatype. Tip: Also look at the CONVERT () function. Required. The value to convert. Required. The …

  7. sql server - Inserting date from string: CAST vs CONVERT

    Dec 21, 2012 · Consider the following two ways to convert a datetime varchar string into a date field: SELECT convert(date, '2012-12-21 21:12:00', 20) -- Only date is needed SELECT …

  8. sql - Why won't string change to date using cast or convert?

    Sep 4, 2019 · Use CONVERT() with an explicit format: SELECT CONVERT(DATE, Workorder.ArrivalDate, 101) FROM JobWorkOrders; If you still have a problem, find the …

  9. What is the Difference Between CAST and CONVERT? - Essential SQL

    Nov 18, 2015 · CAST is part of the ANSI-SQL specification; whereas, CONVERT is not. In fact, CONVERT is SQL implementation-specific. CONVERT differences lie in that it accepts an …

  10. Using CAST and CONVERT Functions in T-SQL - PiEmbSysTech

    Feb 19, 2025 · The CAST function follows ANSI SQL standards and is preferred for portability, while CONVERT provides additional formatting options, especially for date and time values. …

  11. Some results have been removed
Refresh