[dba-SQLServer] Referencing Another Database from within a different current database connection.

Ken Stoker kens.programming at verizon.net
Wed Sep 8 12:21:26 CDT 2004


Everyone,

 

I am trying to copy data from one database into another database within my
single SQL Server instance.  I have qualified my table names with 

            

            databasename.dbo.tablename

 

 

in the following script, but SQL Server gives me the following error:

 

            The column prefix 'Conflict.dbo' does not match with a table
name or alias name used in the query.

 

Here is the script.  Can anyone tell me what I am doing wrong?

 

INSERT INTO 90604.dbo.CodeTypes(CodeTypeID, Description, CreateUser,
CreateDate, UpdateUser, UpdateDate)

SELECT CodeTypeID, Description, CreateUser, CreateDate, UpdateUser,
UpdateDate

FROM Conflict.dbo.CodeTypes

WHERE Conflict.dbo.CodeTypes NOT IN (SELECT DISTINCT CodeTypeID FROM
90604.dbo.Codes)

 

I have done this before and I went back and reviewed the script I used, but
everything looks the same to me.  The only difference with the previous
script was that I was copying data from one server to another server, so I
had server name before the database name.  I tried putting the server name
on the front also but that didn't change anything.  I also tried taking out
'dbo' and having 

 

            databasename..tablename

 

but it also didn't change anything.

 

Thanks 

 

Ken

 




More information about the dba-SQLServer mailing list