I suspect this is because Vague_date_end is an integer, but the Year function is specified as working on datetime and some internal conversion isn't doing what you would expect. The user defined function [dbo].[LCReturnDate] can return a year. This takes the vague_date_end (or any date in integer format), the vague_date_type and the date part to be returned. The vague_date_Type is there just to cover the situation of vague_date_type 'U' (unknown).
For example [dbo].[LCReturnDate] (Sample.vague_date_end, sample.vague_date_type,'Y') will return the correct year unless the vague date type is U (unknown) when it will return null. The function can also return other date parts.
Mike
Mike
Mike Weideli