Solved

update statement

Posted on 2012-04-10
4
288 Views
Last Modified: 2012-04-10
Hi

can anyone give me an example of a query to update values in a table to be the same as the values in a view where the table id= view id?

Cheers
0
Comment
Question by:ac_davis2002
  • 2
4 Comments
 
LVL 15

Assisted Solution

by:Anuj
Anuj earned 334 total points
Comment Utility
UPDATE Table
SET T.Column = V.Column
FROM Table T
INNER JOIN View V
ON V.ID = T.ID
0
 

Author Comment

by:ac_davis2002
Comment Utility
sorry forgot to add the view is on a different database?
0
 
LVL 15

Accepted Solution

by:
Anuj earned 334 total points
Comment Utility
So put the DatabaseName.SchemaName.ViewName in join
eg: Inner Join Sales.dbo.Products
0
 
LVL 15

Assisted Solution

by:deepakChauhan
deepakChauhan earned 166 total points
Comment Utility
This is tested and working fine

Update table1 set t.column=v.column
from databasename.dbo.viewname as V
where table1.id=v.id

Please ensure that You have select permission on the other database view
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now