write down the sql query?

Table Name : emp1
empid empname
1 bala
2 guna

Table Name : emp2
empid empname
1 <Null>
2 <Null>

Solution : emp1 names are updated in emp2, write a query?

Answer Posted / pradip jain

update e2
set e2.name= e1.name
from emp2 e2
join emp1 e1 on e1.id=e2.id

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the system database in sql server 2008?

571


How will you optimize a stored procedure optimization?

502


What is a dbms wizard?

611


How to get the definition of a stored procedure back?

519


How to drop an existing table with "drop table" statements in ms sql server?

546






Explain partitioned view?

583


In which tcp/ip port does sql server run? Can it be changed?

540


How many types of relations are there between dimension and measure group? : sql server analysis services, ssas

746


Why use “nolock” in sql server?

551


What authentication modes does sql server support?

590


What are the pros and cons of putting a scalar function in a queries select list or in the where clause?

710


What is the difference between for auto and for nested?

501


Describe how to use the linked server?

589


Why are sql functions used?

614


What is difference between clustered and non clustered index?

522