I have a database with existing data that uses the datetime field which is a timestamp that uses date and time.
I want to just store the date, not the time, as the time is never used anyway but due to the way the app works it is causing inconsistencies when reporting on the data.
I believe there is a ‘date’ data type using the Design view on my table but when I tried to use that it said invalid data type. I also can’t do this using the ALTER TABLE syntax in SQL.
Because it’s live data, I don’t want to make too many changes that might cause problems. We have a demo system that I can play around with though.
SQL server 2008 has a
datedatatype, which only stores datethe easiest way to do is to alter the table like this:
Since you cannot alter the table , I think the only way left is convert while selecting
Or you can create a view with this select statement and use that view in all your queries
SQL fiddle demo