l******9 发帖数: 579 | 1 【 以下文字转载自 Quant 讨论区 】
发信人: light009 (light009), 信区: Quant
标 题: change year format in Access by SQL query
发信站: BBS 未名空间站 (Mon Oct 13 12:50:53 2014, 美东)
I am working on Access 2012 on win 7. In a table, I need to change a year
date format from '1-Jan-06' to 2006 and from '1-Jan-90' to 1990. I only need
year.
This is my query
SELECT *,
CASE
WHEN CAST(right(year_date,2) , INT) <= 12
THEN 2000 + CAST(right(year_date,2) , INT)
ELSE 1900 + CAST(right(year_date,2) , INT)
END
FROM my_table;
I got error:
syntax error (missing operator) in the query expression of 'CASE -- END'. | B*****g 发帖数: 34098 | 2 http://www.mitbbs.com/article/Programming/31374551_0.html
need
【在 l******9 的大作中提到】 : 【 以下文字转载自 Quant 讨论区 】 : 发信人: light009 (light009), 信区: Quant : 标 题: change year format in Access by SQL query : 发信站: BBS 未名空间站 (Mon Oct 13 12:50:53 2014, 美东) : I am working on Access 2012 on win 7. In a table, I need to change a year : date format from '1-Jan-06' to 2006 and from '1-Jan-90' to 1990. I only need : year. : This is my query : SELECT *, : CASE
|
|