how to update a Sting mmddyyyy format to YYYYMMDD format in sql. the column name is DOB and i want to update the dob column to YYYYMMDD format
how to update a Sting mmddyyyy format to YYYYMMDD format in sql. the column name is DOB and i want to update the dob column to YYYYMMDD format
Unless you change the column datatype to something character based, which would be one of the biggest mistakes you'll ever make, you can't change the format of the underlying DATE, DATETIME, or DATETIME2() column. You CAN, however, change what is view in a SELECT. Lookup the CONVERT function in the Microsoft documentation for T-SQL.. If someone suggests it, DO NOT USE THE FORMAT FUNCTION!!!! It's usually at least 43 times slower than the CONVERT function.
I also suggest you bookmark and study the article because the CONVERT function has a huge number of uses including frequent use for formatting dates and times.
20 People are following this question.