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
Answer / prashant
SELECT DISTINCT empname,dnname,dno,salary into New Table
from emp
Is This Answer Correct ? | 3 Yes | 2 No |
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 |
How to add a new column to an existing table with "alter table ... Add" in ms sql server?
What is the dbcc command and why is it used?
What is autocommit mode in sql server?
What are the High-Availability solutions in SQL Server and differentiate them briefly?
What is data compression?
What is the datatype returned by count(*)
22 Answers 247Customer, Asian CERC,
Can you explain the disadvantages/limitation of the cursor?
Assume,there are three tables in a database, Can i have both primary key and foreign key for each table in the same database?
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
Do you know the capabilities of cursors?
How to restore performance issues and how to check?
What do you understand by hotfixes and patches in sql server?