martes, diciembre 15, 2009

Obtener parte de la fecha en Sql Server

Puedes usar una conversión para realizar la operación

SELECT CONVERT(nvarchar(7), myDate, 126) FROM Table
Group By CONVERT(nvarchar(7), GETDATE(), 126)

Pregunta Original
I have a datefield that basically represents its date in this format.

2009-12-15 16:20:44.930

I need to extract the date part ie '2009-12' for a group by and order by section of a query.

Can someone show me how this could be done.

Liga a la pregunta original