Link to home
Start Free TrialLog in
Avatar of dfincham28
dfincham28

asked on

SQL Syntax for an Update with a Select

I want to update a number of records using an update and a select statement. The table has a lot of columns so I don't want to have specify every single column that will be updated. The two tables I'm using have the same columns.(It is the same table in two different databases.)

I'm looking for syntax something like :
Update Database1.dbo.MyTable A1 Set (Select * FROM Database2.dbo.MyTable B1 JOIN B1.Id = A1.Id)
WHERE A1.description like 'x'

Is this possible?
ASKER CERTIFIED SOLUTION
Avatar of Andrew Crofts
Andrew Crofts
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>The table has a lot of columns so I don't want to have specify every single column that will be updated.
sorry, I read that part only afterwards...
I have to agree, it's not possible (and would not be good practice anyhow)
Why a 'B'?
What was missing from my answer?