I am trying to write a stored procedure for SQL Server 2008. It is for a migration tool that migrates data from one database to another.
I want to get all records from the old database that aren't yet present in the new database. For that end I use the stored procedure below. But I get the error
The multi-part indentifier could not be bound
while executing the stored procedure. What can I do to make this work?
Here is the SP:
SELECT *
FROM Measurement_device
WHERE Measurement_device.Department_Code = '99'
AND mir.dbo.Gages.Gage_code != Device_Number