how to copy only distinct data into another table which is not already exist in database?

Answers were Sorted based on User's Feedback



how to copy only distinct data into another table which is not already exist in database?..

Answer / karthik soundararajan

TableA -- Existing Table

ID
5
5
5
5
5

Solution : SELECT DISTINCT ID INTO TableB FROM TableA

It create a table called TableB and insert only one record as shown below:

ID
5

Is This Answer Correct ?    3 Yes 1 No

how to copy only distinct data into another table which is not already exist in database?..

Answer / sheshu4040

SELECT DISTINCT * INTO TABLE_NEW FROM TABLE_EXISTING

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is hot add cpu in sql server 2008?

0 Answers  


How does index makes search faster?

0 Answers   QuestPond,


What is the STUFF function and how does it differ from the REPLACE function?

2 Answers  


where do you use Isolations?give me some exmpale?

1 Answers  


What are security principals used in sql server 2005?

0 Answers  






What will be the maximum number of indexes per table?

0 Answers  


table:employee EID ENAME MID(manager ids) 101 rama null 102 sita 101 103 siva 101 104 ganesh 103 . . . . . . for 103 ID the manager ID is 101(RAMA) and for 104 manager is SIVA if i give employee id (EID) you have to tell the manager for that EID write query? eample:if i give 102 .The query output should be manager for 102 ID that it should print RAMA as output

7 Answers  


How do you test your database? : sql server database administration

0 Answers  


What is use of @@ spid in sql server?

0 Answers  


How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?

0 Answers  


Explain in brief how sql server enhances scalability of the database system?

0 Answers  


diffrence between function and procedure

5 Answers   Wipro,


Categories