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

Billy Pang tuxedo_man at hotmail.com
Thu Sep 9 02:32:58 CDT 2004


the source of problem is probably caused by "Conflict.dbo.CodeTypes" column. 
  the database thinks that conflict.dbo is a table alias, which it is not.  
remove the "conflict.dbo." and it should work...(ie... WHERE CodeTypes NOT 
...)

HTH
Billy

>From: "Ken Stoker" <kens.programming at verizon.net>
>Reply-To: dba-sqlserver at databaseadvisors.com
>To: <dba-sqlserver at databaseadvisors.com>
>Subject: [dba-SQLServer] Referencing Another Database from within a 
>differentcurrent database connection.
>Date: Wed, 8 Sep 2004 10:21:26 -0700
>
>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
>
>
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>

_________________________________________________________________
Powerful Parental Controls Let your child discover the best the Internet has 
to offer.  
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN® Premium right now and get the 
first two months FREE*.




More information about the dba-SQLServer mailing list