I have a table with over a hundred columns, but I only want to select the the columns named nvarchar1, nvarchar2, ... nvarchar64. All of these 64 columns are next to each other so I was thinking maybe there is a way to select using column indices, but I couldn't find a solution.
Note: I don't want to do the obvious solution,
SELECT nvarchar1,
nvarchar2,
...
nvarchar64
...
Make use of the result from this query:
select column_name + ','
from information_schema.columns
where table_name = 'your table name'
and column_name like 'nvarchar%'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.