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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I find the port number for sql server?

506


What is the difference between the 2 operating modes of database mirroring?

579


What is recompile sql server?

573


Can we insert data into view sql server?

514


What are different types of replication in sql server?

572






What is surrogate key? : sql server analysis services, ssas

701


What are the different types of locks in the database?

488


Explain what is the difference between a local and a global temporary table?

517


How to use union to merge outputs from two queries together in ms sql server?

562


What is the main purpose of having conversation group?

498


How can you manage sql azure security?

85


Explain about nested stored procedure?

608


Explain activity monitors

625


How to delete multiple rows with one delete statement in ms sql server?

520


Why use “nolock” in sql server?

565