如何使用 between operator using dynamic content in adf sql server source dataset

How to use between operator using dynamic content in adf sql server source dataset

我有 sql 服务器作为源,它在 UTC 中有一列“create_ts”。我正在尝试使用以下查询将数据复制到 adls:

@concat('select * from dbo.table where create_ts between',' '',utcnow(),'' ','and',' '',subtractFromTime(utcnow(), 1, 'Day'),'' ')

以上查询抛出错误 Missing comma between arguments。如果我删除日期的“”,则实际查询失败。如何转义 ' 字符或使用此查询的替代方法?

请试试这个SQL:

select * from dbo.table where create_ts between '@{substring(utcnow(),0,23)}' and '@{substring(addDays(utcnow(),1),0,23)}'

我试过了,效果不错。