我正在尝试从Openquery获取值。你能否告诉我如何将这个where子句翻译成Openquery语句?
select *
from openquery(
XYZ,
'select
concat(RTRIM(LTRIM(Digit1)), '',''
,RTRIM(LTRIM(Digit2)), '', ''
, RTRIM(LTRIM(Digit3))) as my_col
, my_category
FROM adventure.mytable
where CAST(CONCAT(Year, Month, Day) as date) =
cast(dateadd(day,datediff(day, 1,GETDATE()),0) AS date)
')
如果在Openquery之外使用,该语句可以正常工作。
示例数据:
Digit1 Digit2 Digit3 Month Day Year Category
5 3 2 December 18 2017 Day
3 0 5 December 18 2017 Evening