Reputation: 3736
I have a copy data activity in the ADF pipeline that copies data from blob to sql table.
I use a script activity in order to create an index using a sql query CREATE CLUSTERED INDEX IDX_ReportsToPersonnelNbr ON TableName(ReportsToPersonnelNbr)
after creating this table via ADF pipeline.
How do I pass the table name from the previous activity to script activity? This is what I tried which gives me the error:
Upvotes: 1
Views: 2051
Reputation: 103
First, I'd select Non Query option, instead of Query.
I don't know how you get there, but I use a for-each activity to do bulk inserts and first I drop the index, then I do the insert and then I recreate the index.
I use this:
CREATE CLUSTERED COLUMNSTORE INDEX CCI_@{item().TargetSchemaName}_@{item().TargetTableName} ON @{item().TargetSchemaName}.@{item().TargetTableName};
item() contains the result of every loop iteration (schemaName and tableName)
Upvotes: 1
Reputation: 23064
You can't really get the tablename out of the Copy Data activity. But what you can do is use a variable to generate your tablename before the Copy Data activity, and then use that variable in both the Copy Data activity and the Script activity:
Like this:
tbl@{replace(pipeline().RunId,'-','')}
expression evaluation@variables('yourVariableName')
CREATE CLUSTERED INDEX IDX_Whatever ON @{variables('yourVariableName')}
Upvotes: 1