You could do the conversion from date to string in the openquery
statement:
select to_char(<datecol>, 'YYYY-MM-DD hh:mi:ss') . . .
Alternatively, you culd use convert()
in SQL Server and do it in the outer select
.
题
I'm trying to retrieve data from Oracle by SQL server so I'm using openquery and I'm able to get date interval this way:
SELECT
*
FROM OPENQUERY(DATABASE,
'SELECT * FROM ORACLE.TABLE
WHERE CREATEDATE between {d ''2013-03-23''} and {d ''2013-03-27''} ')
how can I do the similar query, but date interval will be in yyyy-mm-dd hh:mm:ss
format and stay with openquery
???
解决方案
You could do the conversion from date to string in the openquery
statement:
select to_char(<datecol>, 'YYYY-MM-DD hh:mi:ss') . . .
Alternatively, you culd use convert()
in SQL Server and do it in the outer select
.