0

I'm trying to do a simple copy of a table from one database to another where a condition is true. However, I am getting a "multi-part identifier could not be bound". My spelling is correct as Intellisense is prompting me through correctly.

Example:

USE database2
SELECT * INTO database2.dbo.Table1
FROM database1.dbo.Table1
WHERE database1.dbo.Table1.Column1 = database2.dbo.Table2.Column2

SQL will complain that the "database2.dbo.table2.Column2" multi-part identifier cannot be bound.

4

1 回答 1

2

In this instance, intellisense doesn't make the statement legitemate.

I think you are wanting to do something along these lines:

SELECT d1.* INTO database2.dbo.Table1 
FROM database1.dbo.Table1 d1
INNER JOIN database2.dbo.Table2 d2
WHERE d1.Column1 = d2.Column2 
于 2012-07-02T17:28:34.370 回答