Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Updating a table while checking a different DB

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-17 : 13:37:07
Ed G writes "I am new at this can someone tell me why the following script will not function correctly?

use testdb1
go
UPDATE dbo.testdb
SET testcol1 = 'test'
WHERE (dbo.testdb.testcolx = testdb2.dbo.testdb.testcolx)

I have tried rearranging this code as much as possible and have encountered the same error:

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

dsdeming

479 Posts

Posted - 2002-06-17 : 13:44:13
You need a FROM clause here. Try something like this:

UPDATE dbo.testdb
SET testcol1 = 'test'
FROM dbo.testdb
JOIN testdb2.dbo.testdb t2 ON dbo.testdb.testcolx = t2.testcolx


Go to Top of Page
   

- Advertisement -