Hi,
I am trying to get list of unique values from each column with number of records.
Is it possible to do in sp/tsql, then how ?
1) list all columns of a table in an array,
2) run select statement on each field from array
3) store result in a temporary table as tmpTable with field Col_Name, Col_Value, RecordCount.
Any ideas please on stored procedure or TSQL
Cheers,
Ken
I am trying to get list of unique values from each column with number of records.
Code:
E.g. A table with 10 columns, then will be writing 10 times
to get unique values and number of records as
Select distinct field1, count(field1) from table1 group by field1
Is it possible to do in sp/tsql, then how ?
1) list all columns of a table in an array,
2) run select statement on each field from array
3) store result in a temporary table as tmpTable with field Col_Name, Col_Value, RecordCount.
Any ideas please on stored procedure or TSQL
Cheers,
Ken