I have a table emp , Fields with empname,dnname,dno,salary.
now I want copy distinct salary with all emp detail from emp into new table which is not already exist in database. how would I do this ?

Answers were Sorted based on User's Feedback



I have a table emp , Fields with empname,dnname,dno,salary. now I want copy distinct salary with all..

Answer / prashant

SELECT DISTINCT empname,dnname,dno,salary into New Table
from emp

Is This Answer Correct ?    3 Yes 2 No

I have a table emp , Fields with empname,dnname,dno,salary. now I want copy distinct salary with all..

Answer / b.kumar

WITH CTE
AS
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY SAL ORDER BY SAL) AS ROWID
FROM EMP7
) SELECT * INTO EMP10 FROM CTE WHERE ROWID=1

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

How to add a new column to an existing table with "alter table ... Add" in ms sql server?

0 Answers  


What is the dbcc command and why is it used?

0 Answers  


What is autocommit mode in sql server?

0 Answers  


What are the High-Availability solutions in SQL Server and differentiate them briefly?

0 Answers  


What is data compression?

0 Answers  






What is the datatype returned by count(*)

22 Answers   247Customer, Asian CERC,


Can you explain the disadvantages/limitation of the cursor?

0 Answers  


Assume,there are three tables in a database, Can i have both primary key and foreign key for each table in the same database?

4 Answers  


In my application I have a process which picks the scanned files (tif format) from a shared location and it links to application and shown on it.The actuall issue is that my process picks the file before it is completly written or scanned which results in displaying few parts of the image or incomplete image.I need to check if the file is not completly scanned or written then do not link it to application.Please help if any body tell me that how can i check that file is in written phase or locked through DTS.thanking you in advance

0 Answers  


Do you know the capabilities of cursors?

0 Answers  


How to restore performance issues and how to check?

0 Answers  


What do you understand by hotfixes and patches in sql server?

0 Answers  


Categories