I wish to be able to be able to do something like this for use with @YearVar later.
SET @YearVar DATETIME = CONVERT(nvarchar, date_hired, 106),
DATEPART(YEAR, date_hired)
However the only way I know how to datepart is like this :
SELECT CONVERT(nvarchar, date_hired, 106) As Hire_Date,
DATEPART(DAY, date_hired) As [Day],
DATEPART(MONTH, date_hired) As [Month],
DATEPART(YEAR, date_hired) AS [Year]
FROM hire
Any help would be great thanks.
Andy