Options

SQL compare: Invalid object name issue

relrel Posts: 5 New member
edited November 2, 2021 4:56PM in SQL Compare
Hi all

I've just tried using SQL Compare (v 14.5.22.19589) to copy data from one database to another (source > destination). I've not run this process for a while but it used to work in the past.

Via Powershell I create a temporary table but not in the sense that it's a SQL temp table (i.e. it's not #myTable) it a proper table that I create and then delete at the end of the process.

So via Powershell, I creating a table (sourceDB.dbo._tempTableSitesToCopy), I then call my sdc "package" which copies data from one database to another then I delete the temporary table. For some reason today I'm getting an error saying the 
Invalid object name 'sourceDB.dbo._tempTableSitesToCopy'

I then tried doing the whole process manually, I created the table (_tempTableSitesToCopy) I then open SQL compare open my .sdc file, press the next buttons and I get the same issue.

SELECT [siteId], [name], [selectorlabel]
FROM [sourceDB].[dbo].[translationkeys] WITH (NOLOCK) 
WHERE siteId IN (SELECT siteId FROM [sourceDB].[dbo].[_tempTableSitesToCopy]) ORDER BY [siteID] COLLATE Latin1_General_CI_AS
Inner SQLException: Invalid object name: '[sourceDB].[dbo].[_tempTableSitesToCopy]'

The above SQL is a filter in the source database where i'm pulling the data from

When I run the above SQL in SSMS it works as expected.

Any ideas how to resolve this.
Tagged:
Sign In or Register to comment.