Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

column to rows tsql

$
0
0


select table_name,column_name from INFORMATION_SCHEMA.COLUMNS where DATA_TYPE = 'varchar'


Output

table_name column_name

t1 c1
t1 c2
t1 c3
t2 col1
t2 col2
t3 column1

Expected Output

I want to generate below listed select statement as output by querying INFORMATION_SCHEMA.COLUMNS table.

select c1,c2,c3 from t1
select col1,col2 from t2
select column1 from t3



With Regards, Khokhar Murtuja S Database Administrator


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>