Format the date in varchar type to mm/dd/yyyy


hi,

i have column in date format. later on, changed nvarchar , existing date changed format "yyyy-mm-dd 00:00:00". how update dates mm/dd/yyyy format. should use expression?

thanks. 

i highly recommend change back date/time type storing.

  • ms sql server has many ways return dates , times formatted want depending on want see , how want see having data date time infinity better. case in point current predicament.
  • sorting , filtering , comparisons on date/time types more efficient , less error prone
  • date/time types have built in validation, trying enter date of february 30 not possible or 27 hours etc.
  • you can execute date/time functions adding year or subtracting month useful when start make use of dates/times
  • writing code against databases dates/times stored strings horrible experience not wish on anyone!

i have maintain db created predecessor date , times everywhere varchar , nightmare, don't if have chance revert back!!! :)


-igor



SQL Server  >  Getting started with SQL Server



Comments

Popular posts from this blog

SQL Server PSProvider SQL Server Authentication

BIT Version

How to calculate the delta size while diffing the files in TeamFoundationServer ?