adspace
I have a table EMP in which the values will be like this
EmpId Ename Sal DeptId
11 Ram 10000 10
11 Ram 10000 10
22 Raj 20000 20
22 Raj 20000 20
33 Anil 15000 30
33 Anil 15000 30
I want to delete only duplicate Rows. After Delete I want
the output like this
EmpId Ename Sal DeptId
11 Ram 10000 10
22 Raj 20000 20
33 Anil 15000 30
Answer Posted / vikas kant
select Distinct * into #Temp_Temp1 from Emp
truncate table Emp
insert into Emp select * from #Temp_Temp1
select * from Emp
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How raid can influence database performance?
What is sql or structured query language?
This question asked during interview, 2) At the end of each month, a new table is created for each bank that contains monthly metrics consolidated at the account level. The table naming convention is bankX_YYYYMM where X represents the numeric designation of the bank and YYYYMM indicates the 4 digit year and 2 digit month. The tables contain the following fields: name data type description account text account number registered boolean indicates whether the account is registered num_trans integer number of transactions made during the time period spend numeric(9,2) total spend during the time period a) Write a SQL query that will display the total number of transactions and total spend for "Bank1" during the 4th quarter of 2009. b) Write a SQL query that will display the total number of transactions and total spend at "Bank1" and "Bank2", broken out by registered vs. non-registered accounts, during January 2010 not sure what is correct answer and how to solve?
Equi join and non equi join is possible with sql server?
What is the difference between upgrade and migration in sql server?
Why and when do stored procedure recompile?
How do I find query history in sql server?
List the ways in which dynamic sql can be executed?
What kind of problems occurs if we do not implement proper locking strategy?
How to connect php with different port numbers?
Can we do dml on views?
How can we solve concurrency problems?
What is the difference between for xml raw and for xml auto?
Is it possible to have clustered index on separate drive from original table location?
Can sql servers link to other servers like oracle?