How to select Distinct columns from the table, table having
20 columns and i want all coulmns

Answer Posted / ram

select * from tablename
select distinct * from tablename
above two select statements give same output with all
column name and also data
if we want only column name & its details(datatype,sizre)
use

select * from
information_schema.columns where table_name='EMP1'
(or)
select distinct * from
information_schema.columns where table_name='EMP1'

(Here Table name mustbe in single quotes and also capital
letters only)
here also both select statements output is same

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between Datepart() and Datename() in SqlServer?

907


What is abstracting periodical?

699


Can group functions be used in the order by clause in ms sql server?

761


What is a constant or literal in ms sql server?

788


What is primary key index?

706






what is hash nonclustered index

714


How to apply filtering criteria at group level with the having clause in ms sql server?

752


Explain the cursor lock types?

741


explain different types of cursors? : Sql server database administration

754


What is failover clustering overview?

765


What are policy management terms?

741


How can delete duplicate records in cte in sql server?

704


Explain Reporting Life Cycle?

102


What is meant by referential integrity?

749


What do you mean by cardinality?

654