how to select multiple variables with same prefix

General
Enthusiast

how to select multiple variables with same prefix

Anyone happened to know how to write in SQLA to

select v_1, v_2, v_3, ...., v_100 from...

in a shortcut way?

Will

select v_1 - v_100 from ...

work?

thanks!

2 REPLIES
Enthusiast

Re: how to select multiple variables with same prefix

anyone can help on this post please?

Senior Supporter

Re: how to select multiple variables with same prefix

no, it's not possible to specify something like select v_1--v_100

you can generate the columnlist with SQL and copy paste the needed columns into your statement

something like

select case when row_number() over (order by columnid) > 1 then ',' else '' end !! trim(columnname)  
from dbc.columns
where databasename = 'dbc'
and tablename = 'columns'
order by columnid