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)
 Issues Updating a table

Author  Topic 

griffed
Starting Member

5 Posts

Posted - 2002-06-12 : 17:00:06
I am trying to update a table after checking column values against values in a different database.

Here is the script that I have attempted to use:

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

I have tried tweeking this as much as I know how to get it to work. I continue to get the following error when trying to execute the query:

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

I am running a SQL server 2000

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-06-12 : 17:07:43
UPDATE dbo.testdb
SET testcol1 = 'test'
FROM dbo.testdb a
JOIN testdb2.dbo.testdb b
ON a.testcolx = b.testcolx


Go to Top of Page
   

- Advertisement -