# Is there a way to filter out all columns that start with say a particular alphabet? Is there a way to use an expression in the filter component? OR is there a way to use a Grid Variable for Field Selection? Any help please?

**URL:** <https://matillioncommunity.discourse.group/t/is-there-a-way-to-filter-out-all-columns-that-start-with-say-a-particular-alphabet-is-there-a-way-to-use-an-expression-in-the-filter-component-or-is-there-a-way-to-use-a-grid-variable-for-field-selection-any-help-please/1291>\
**Category:** Matillion ETL\
**Created:** [March 31, 2021, 5:54pm UTC](https://matillioncommunity.discourse.group/t/is-there-a-way-to-filter-out-all-columns-that-start-with-say-a-particular-alphabet-is-there-a-way-to-use-an-expression-in-the-filter-component-or-is-there-a-way-to-use-a-grid-variable-for-field-selection-any-help-please/1291 "2021-03-31T17:54:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![VVeda](https://sea2.discourse-cdn.com/flex002/user_avatar/matillioncommunity.discourse.group/vveda/32/834_2.png) [@VVeda](https://matillioncommunity.discourse.group/u/VVeda)\
**Post date:** [March 31, 2021, 5:54pm UTC](https://matillioncommunity.discourse.group/t/is-there-a-way-to-filter-out-all-columns-that-start-with-say-a-particular-alphabet-is-there-a-way-to-use-an-expression-in-the-filter-component-or-is-there-a-way-to-use-a-grid-variable-for-field-selection-any-help-please/1291/1 "2021-03-31T17:54:08Z")

</div>

Is there a way to filter out all columns that start with say a particular alphabet? Is there a way to use an expression in the filter component? OR is there a way to use a Grid Variable for Field Selection? Any help please?

---

<div class="post-metadata">

**Author:** ![VVeda](https://sea2.discourse-cdn.com/flex002/user_avatar/matillioncommunity.discourse.group/vveda/32/834_2.png) [@VVeda](https://matillioncommunity.discourse.group/u/VVeda)\
**Post date:** [March 31, 2021, 7:26pm UTC](https://matillioncommunity.discourse.group/t/is-there-a-way-to-filter-out-all-columns-that-start-with-say-a-particular-alphabet-is-there-a-way-to-use-an-expression-in-the-filter-component-or-is-there-a-way-to-use-a-grid-variable-for-field-selection-any-help-please/1291/2 "2021-03-31T19:26:45Z")

</div>

More details :

I'm connecting to a SQL server db via Matillion and trying to load a table into Snowflake. The table has about 70 to 80 columns. about 50 of these are that start with alphabets 'V' and 'C' . I want to be able to filter out and not load anything that starts with a C. What is the ideal way to do this? ( example of column names - V12345, C12345678) and so on

---

<div class="post-metadata">

**Author:** ![KevinH](https://avatars.discourse-cdn.com/v4/letter/k/4af34b/32.png) [@KevinH](https://matillioncommunity.discourse.group/u/KevinH)\
**Post date:** [March 31, 2021, 9:36pm UTC](https://matillioncommunity.discourse.group/t/is-there-a-way-to-filter-out-all-columns-that-start-with-say-a-particular-alphabet-is-there-a-way-to-use-an-expression-in-the-filter-component-or-is-there-a-way-to-use-a-grid-variable-for-field-selection-any-help-please/1291/3 "2021-03-31T21:36:48Z")

</div>

I haven't done it before, but glancing at what is available, I'd probably try this: "Table Metadata to Grid" to get column names, followed by a "Grid Iterator" to iterate over those column names. Within each iteration: for each column name, if it starts with a 'C', then do something with it; else ignore it.

---

<div class="post-metadata">

**Author:** ![VVeda](https://sea2.discourse-cdn.com/flex002/user_avatar/matillioncommunity.discourse.group/vveda/32/834_2.png) [@VVeda](https://matillioncommunity.discourse.group/u/VVeda)\
**Post date:** [April 1, 2021, 1:46pm UTC](https://matillioncommunity.discourse.group/t/is-there-a-way-to-filter-out-all-columns-that-start-with-say-a-particular-alphabet-is-there-a-way-to-use-an-expression-in-the-filter-component-or-is-there-a-way-to-use-a-grid-variable-for-field-selection-any-help-please/1291/4 "2021-04-01T13:46:21Z")

</div>

Thanks for your response Kevin. I'll check this out and let you know.

---

<div class="post-metadata">

**Author:** ![Murali](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@Murali](https://matillioncommunity.discourse.group/u/Murali)\
**Post date:** [April 1, 2021, 2:23pm UTC](https://matillioncommunity.discourse.group/t/is-there-a-way-to-filter-out-all-columns-that-start-with-say-a-particular-alphabet-is-there-a-way-to-use-an-expression-in-the-filter-component-or-is-there-a-way-to-use-a-grid-variable-for-field-selection-any-help-please/1291/5 "2021-04-01T14:23:55Z")

</div>

I do something like below , to create the insert statement for any table dynamically :

SELECT&nbsp;

listagg(A.COLUMN\_NAME, ', ') AS C,&nbsp;

&nbsp;&nbsp;COUNT(A.COLUMN\_NAME)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS C\_CNT,

&nbsp;&nbsp;listagg(B.COLUMN\_NAME, ', ') AS V ,

&nbsp;&nbsp;COUNT(B.COLUMN\_NAME)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AS V\_CNT

FROM DATALAKE.INFORMATION\_SCHEMA.COLUMNS A, DATALAKE.INFORMATION\_SCHEMA.COLUMNS B&nbsp;&nbsp;

WHERE A.COLUMN\_NAME = B.COLUMN\_NAME AND&nbsp;A.COLUMN\_NAME NOT IN ('LAKE\_LOAD\_ID','DATA\_DT') AND&nbsp;

A.TABLE\_NAME = TRIM('${L\_LAKE\_TABLE\_NAME}') AND B.TABLE\_NAME = TRIM('${L\_LAND\_TABLE\_NAME}' )

ORDER BY A.ORDINAL\_POSITION

&nbsp;

I dont know the metadata table for SQL Server. But, this concept can be extended for filtering out the columns too as ,

A.COLUMN\_NAME NOT LIKE ('V%') AND A.COLUMN\_NAME NOT LIKE ('C%')
