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 ?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How to convert character strings into numeric values?

567


What languages bi uses to achieve the goal?

502


Do you know sql server 2008 introduces automatic auditing?

508


How to deploy the Report?

93


How to create function with parameter in sql server?

547






Do you know sql server 2008 backup compression?

562


How to change the password of a login name in ms sql server?

551


What is the concept of optimization?

557


Do you know how to implement service broker?

531


Is truncate autocommit?

551


What is RMS migrations?

1694


What is coalesce and check constraint in sql server?

535


how many triggers you can have on a table? : Sql server database administration

486


How to transfer an existing table from one schema to another schema in ms sql server?

504


Explain following error properties?

550