我尝试过
FROM OPENQUERY(TESTsvr,
Select to_date(CREATE_DT, "MM/DD/YYYY") as Testing
From Test.ViewTest
和
FROM OPENQUERY(TESTsvr,
to_char(CREATE_DT, "mm/dd/yyyy hh24:mi:ss") as Testing
From Test.ViewTest
但是当我执行它时,它说出无效的标识符。
答案 0 :(得分:1)
尝试使用引号: 如果要将日期转换为char:
FROM OPENQUERY(TESTsvr,
'select to_char(CREATE_DT, ''mm/dd/yyyy hh24:mi:ss'') as Testing From Test.ViewTest')
如果要将char转换为日期:
FROM OPENQUERY(TESTsvr,
'select to_date(CREATE_DT, ''mm/dd/yyyy'') as Testing From Test.ViewTest')
如果要将NUMBER(8)转换为日期(如yyyymmdd):
FROM OPENQUERY(TESTsvr,
'select to_date(CREATE_DT, ''yyyymmdd'') as Testing From Test.ViewTest')