I have a procedure call FILLTABLE in DB1, that procedure control the insert in DB1.table1, and I have all data in DB2.table1, so basicaly I need fill DB1.table1 by procededure FILLTABLE from BD2.table1 but filter data DB2.table1
Eg:
Execute BD1.dbo.FILLTABLE (
select db2.dbo.table1.name as @name,
db2.dbo.table1.phonea s @phone
from table1
where citycode = 'ca')
If I’ve got it right you should use cursor