I'm creating a table and want to store one field as date datatype. However I only want to store the year and not additional info (ie: month, day, or time.)
Here is what I have so far:
CREATE TABLE Project
(ProjectID int not null identity(1,1) unique
,PreviousYear1 date -- I need this format: (YYYY)
)
Any suggestions on how to store a year only date data-type? I'm working in ssms -2012. My aim is to accomplish this without later having to convert the datatype or alter it to only show year.
We can't, but you could use:
When you'll save a record just put a string with the year :)