Hello and thank you or your question. Before I can talk about the answer, there are a couple points I would like to make.
I can see, in your query you use
... '@activity('Lookup1').output' as datetime2)
You probably want to use something like
...'@{activity('Lookup1').output.value}' as datetime2)
There are two changes here.
{ ... } the curly braces help tell data factory where the expression begins and ends, also converts to string. Without this it might consider the ' as datetime2)
as part of the expression.
...output.value
selects the data returned by the lookup. Without the .value
part, you can get a complex JSON object with more info about the activity execution. You may need to also add the column name ...output.value.dateColumnName
.
Next I would like to show you how to see what the value should be.
There is a way you can debug run the lookup without running the copy activity. There is a red circle. Click it, and when filled, will act as a breakpoint. Doing a debug run like this will let you see what the output of the lookup activity is, and thus what the value you should use is.