June 15, 2006 at 5:33 am
How do I convert a datetime value into just the 4 digit year?
June 15, 2006 at 5:37 am
You can use DATENAME function to do this. This will do it for the current date.
SELECT DATENAME( year, GetDate() )
Or in a query
SELECT DATENAME( year, <ColumnName> )
FROM <TableName>
Where Column name is the name of the column and Table name is the name of the table.
Andez
June 15, 2006 at 5:41 am
Or simply
SELECT YEAR(MyField) FROM MyTable
N 56°04'39.16"
E 12°55'05.25"
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy