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

write a query to remove duplicate records without using primary key column?

2 Answers   ABCO,


What is the difference between MVC and Teir Architecher? Plz explain with Layyered Programming example...? Thanks

0 Answers   TCS,


What is the difference between ROW_NUMBER and Ranking function in SQL SERVER?

0 Answers  


What are the different types of collation sensitivity?

0 Answers  


How to create a local temporary stored procedure?

0 Answers  






How to list all user defined functions in the current database?

0 Answers  


Explain mixed authentication mode of sql server?

0 Answers  


Can you explain powershell included in sql server 2008?

0 Answers  


Can you give an example of Stored Procedure?

4 Answers   Wipro,


Explain indexed views and partitioned view with their syntax.

0 Answers  


What are the hotfixes and patches in sql server?

0 Answers  


What is the contrast between sql and mysql?

0 Answers  


Categories