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

When we should use @@error?

0 Answers  


Explain about SQLOS?

0 Answers  


What is scd (slowly changing dimension)? : sql server analysis services, ssas

0 Answers  


If I delete a template from the list in sql studio, will it be deleted from the hard disk? : sql server management studio

0 Answers  


What do you understand by recursive stored procedure?

0 Answers  






How display code or Text of Stored Procedure using Sql query in Sql Server ?

0 Answers   Wipro,


What is a unique key constraint?

0 Answers  


Can I run multiple instances of sql server 2000 at the same time on one computer?

0 Answers  


What is scrollable cursor?

0 Answers  


Why foreign key column allowing null values even a parent tables reference key column not having null value..

2 Answers   IBM,


explain the difference between oracle- sql and sql server sql ? if both are same y we r using 2 sw.s?

0 Answers   ADP, iSoft,


how will u create "n" possible tables in sql...

1 Answers   Oracle,


Categories