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

How can i give the restrictions for the data entry, if i wish to enter only I ,II, III, IV in the grade actegory of student table?

3 Answers  


What changes in the front end code is needed if mirroring is implemented for the high availability? : sql server database administration

0 Answers  


What are dml (data manipulation language) statements in ms sql server?

0 Answers  


Explain nested join?

0 Answers  


What is trace flag in sql server?

0 Answers  






what is meant by sql injection with example and one more question how to catch the errors in sqlserver

2 Answers  


How do I schedule a sql server profiler trace?

0 Answers  


What is a covering index?

0 Answers  


Is it possible to update the views? If yes, how, if not, why?

0 Answers  


What is the difference between dropping a database and taking a database offline?

0 Answers  


Is it possible to create a stored procedure that runs a query and outputs the results to a text file and allows me to add extra delimeters and static field info. If so How?

1 Answers  


What is the size of transaction log file?

0 Answers  


Categories