Im creating a Unique constraint, that only allows to use the a Registry number per year, with this i mean that can exist more that one number 2, in the registry but only if this were created on different years. I have heard that it is possible to do ir with the Unique constraint but i do not know how, without needing to create a column for year and another for month, and ect.
Query
ALTER TABLE dbo.correspondencia_FFAA
ADD CONSTRAINT uk_correspondecia UNIQUE (num_corres, fecha_cre);
num_corres is the Registry Number, and fecha_cre is the Creation Date, but i only need the year not the whole column, is it possible
Thanks