Search code examples
t-sqlazure-data-factory

In ADF I am getting an error - there is already an object names sqldb in database


In Azure Data Factory, I have to write the foldername and the count of files in folder in sqldb.

I wrote this statement inside the lookup activity

create table dbo.sqldb12(name char(20), count int),

insert into sqldb12 
values ('@{item().name}', @{int(activity('Filter1').output.ItemsCount)})

select * from sqldb12

item().name is the output of foreach activity which is basically a foldernames

(activity('Filter1').output.ItemsCount -- this activity will return the counts

Do you know why I am getting this error?


Solution

  • The error message is self explanatory. Since you are running the look up activity within for iteration, the create table query on 1st iteration would create a table but in subsequent iterations would throw an error stating it already exists