سؤال

I'm writing an SQL expression and I'd like to use the current month as the column name/header.

Code:

Select MONTH(GETDATE()) AS MONTH(GETDATE())
FROM SomeTable;

Error:

Error 102: Incorrect syntax near 'GETDATE'.

This is for a school project and I'm not sure if it's possible. If it is, I'd like to possibly convert that Month number to the actual month name. Thanks in advance.

Oh, and I'm using LinqPad to test the queries on a remote DB and SQL Express Server (Transact-SQL).

Cheers, Lindsay

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top