I need a select query thats returns the value of some columns. The column that I want starts with 'U_S'.
Select * from em
I need to transform the query above. The '*' needs to be the result (but with commas) of:
select COLUMN_NAME from information_schema.columns
where table_name='em' and column_name like 'u_s%'
There are countless examples like this, but I understand that sometimes we all need a little kick-start.
Select Stuff((Select ',' +quotename(Column_Name)
From information_schema.columns
Where table_name='em' and column_name like 'u_s%'
For XML Path ('')),1,1,'')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With