August 15, 2006 at 3:57 pm
I'm trying to update a table in MyDB1 with a value in MyDB2 on the same SQL server (2000)
UPDATE MyDB1.dbo.Users
SET MyDB1.dbo.Users.InstantASP_UserID = MyDB2.dbo.InstantASP_Users.UserID
FROM MyDB2
INNER JOIN dbo.aspnet_Membership a ON a.UserId = MyDB1.dbo.Users.UserID
WHERE MyDB2.dbo.InstantASP_Users.EmailAddress = a.Email
I don't want to have to create a linked server. It's on the same box.
I'm getting Invalid object name 'MyDB2'.
August 15, 2006 at 4:08 pm
FROM MyDB2
The FROM in an UPDATE (or SELECT) expects a table name. You've given it a database name, not a table name.
You don't need a linked server. The databases are all on the same server instance, so no need for a link.
August 15, 2006 at 7:26 pm
Obviously, I've not tested this... but it should work...
UPDATE u1
SET InstantASP_UserID = u2.UserID
FROM MyDB1.dbo.Users u1,
MyDB2.dbo.InstantASP_Users u2,
dbo.aspnet_Membership a
WHERE a.UserId = u1.UserID
AND u2.EmailAddress = a.Email
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply