简体   繁体   中英

azure ADF Pipeline query

How to write where clause in select query.

The below statement gives error for where clause, whats the syntax, I need to bring limited data from source table, please help

 "sqlReaderQuery": "$$Text.Format('Select OwningBusinessUnitName],[OwningTeam],[OwningTeamName],[StatusCodeName],[StateCodeName],[PriorityCode],[PriorityCodeName],[ActivityUrlLink],[Description] FROM Activities WHERE [CreatedOn] >= '216-02-01')"

Taking a look at the documentation and examples here , you need to escape the single quotes:

"SqlReaderQuery": "$$Text.Format('SELECT * FROM MyTable WHERE StartDateTime = \\'{0:yyyyMMdd-HH}\\'', WindowStart)"

Note, it is double back-slash! (may be omitted here due to formatting) After all, you are editing a JSON where single quotes do have quite a meaning:

I had a complex sql query that had numerous single quotes. Escaping them with:

\\' 

didn't work. However, escaping them with \\' did work. Escaping using \\' is not correct from a JSON perspective, but that is what worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM