专栏不会绑定

时间:2012-08-14 17:56:09

标签: sql-server

我将以下声明作为存储过程的第一步

As
BEGIN
SET NOCOUNT ON
  DELETE DB1.dbo.Members WHERE DB1.dbo.members.ID = DB2.dbo.in_table.ID
  --after the delete I will insert all of the new data from in_table to Members
END

DB2.dbo.in_table.ID不会绑定。存储过程设置为存储在DB2上。 DB1位置绑定完美。这是数据库权限问题吗?

1 个答案:

答案 0 :(得分:1)

您没有在查询中的任何位置引用或加入第二个表:

DELETE 
FROM DB1.dbo.Members 
WHERE EXISTS (SELECT ID 
                FROM DB2.dbo.in_table 
                WHERE DB1.dbo.Members.id = B2.dbo.in_table.ID)