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
How to execute stored procedure and set temp table in sql server?
can we have a nested transaction? : Sql server database administration
What are the database objects? : SQL Server Architecture
Is it true that rules do not apply to data already existing in a database at the time the rule is created?
Define primary key?
What is Fragmentation and Defragmentation? For 32GB Table,How can we do the fragmentation?
What are the key configuration files for sql server reporting services ?
Are connections to sql server encrypted?
How can you hide the sql server instances?
What are triggers? How many triggers you can have on a table? How to invoke a trigger on demand?
Does windows server 2016 come with sql server?
Explain indexes disadvantages?
How to delete duplicate rows in sql server?
List some advantages and disadvantages of stored procedure?
is there a column to which a default can't be bound? : Sql server database administration