All Forums General
wangguojie2006 8 posts Joined 09/13
20 Sep 2013
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!

wangguojie2006 8 posts Joined 09/13
21 Sep 2013

anyone can help on this post please?

ulrich 816 posts Joined 09/09
23 Sep 2013

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

 

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

You must sign in to leave a comment.