Vega
Vega

Reputation: 1

Datepart MONTH invalid column

SELECT DATEPART(MONTH, SentTime)  
FROM myTable

Where SentTime is a timestamp (ex. 2019-04-22 11:16:00) Its the same deal even if I do a different datepart such as WEEK, wk, year, etc

SQL Error [260] [HY000]:(at 16): invalid column name: MONTH: line 1 col 17 (at pos 16) invalid column name: MONTH: line 1 col 17 (at pos 16)

Thank you

Upvotes: 0

Views: 1106

Answers (1)

Lars Br.
Lars Br.

Reputation: 10388

DATEPART is a MS SQL Server function; with SAP HANA you can use either MONTH() or EXTRACT(MONTH FROM <value>).

Upvotes: 1

Related Questions