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?
Answers were Sorted based on User's Feedback
Answer / dhana
update e2 set e2.empname = e1.empname
from emp2 e2,emp1 e1
where e1.empid = e2.empid
| Is This Answer Correct ? | 8 Yes | 1 No |
Answer / vidya
update emp2 set empname =e.empname from emp1 e where
e.empid =emp2.empid
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / a
Update emp2 set empname = (Select empName from emp1 where
emp2.empid =emp1.empid)
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / vicky
update emp2 e2 set e2.empname = (select e1.empname from
emp1 e1 where e2.empid=e1.empid)
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / saravanan
update w set w.ename=q.ename from empn1 w,
(select e.ename,e.empid from empn e,empn1 a where
a.empid=e.empid) q where w.empid=q.empid
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / rajesh.a
Update e2
set e2.empname=e1.empname
from
emp2 e2 inner join emp1 e1 on e1.empid=e2.empid
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / 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 |
Let us say the SQL Server crashed and you are rebuilding the databases including the master database what procedure to you follow?
Which sql server is best?
Distinguish between commit and rollback?
Say if we have a table that contains only a single column , say OrderID, which has IDENTITY attribute defined on it. So how can we insert data in this table. I am reframing my question, that how can we make the table to increment the column "OrderID" value several times???
How do I list the available tables in a database I'm querying?
Please give me queries for the following 1. To get the count of duplicate records. 2. A query to delete the duplicate records.
how to find number of columns in a table in sql server 2000 and 2005 also
What is the difference between a check constraint and a rule?
Detail about the hardware which is supported by SQL server?
How to Generate a Series of Random Integers With T-SQL?
What is the default isolation level of the sql server database?
What is the difference between login and a user?
13 Answers CTS, TCS,
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)