# SSRS (Snowflake): Select/Filter column by string with a comma in it

**URL:** <https://forums.percona.com/t/ssrs-snowflake-select-filter-column-by-string-with-a-comma-in-it/27144>\
**Category:** Other Tools\
**Tags:** mysql\
**Created:** [December 14, 2023, 11:14am UTC](https://forums.percona.com/t/ssrs-snowflake-select-filter-column-by-string-with-a-comma-in-it/27144 "2023-12-14T11:14:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MOKSHAGNYA\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mokshagnya_a/32/14185_2.png) [@MOKSHAGNYA\_A](https://forums.percona.com/u/MOKSHAGNYA_A)\
**Post date:** [December 14, 2023, 11:14am UTC](https://forums.percona.com/t/ssrs-snowflake-select-filter-column-by-string-with-a-comma-in-it/27144/1 "2023-12-14T11:14:09Z")

</div>

A column in a Table I am querying has values ‘183160,WELD’, ‘87491,WELD’, ‘874910,WELD’, ‘87491N,WELD’.

In Snowflake, I started with this Case Statement:

```auto
When ProcedureCode In('183160,WELD', '87491,WELD', '874910,WELD', '87491N,WELD') Then 'CHL' 

```

While it worked fine in Snowflake, it errored when I used it in SSRS for Snowflake. [See SSRS error message further down this post.

Believing that there was an issue with the fact that there were commas in the ProcedureCode values, I switched my SQL to:

```auto
When (Left(cspc.procedureCode, 6) In ('183160', '874910', '87491N') And Right (cspc.procedureCode, 4) = 'WELD') Then 'CHL'
When (Left(cspc.procedureCode, 5) = '87491' And Right (cspc.procedureCode, 4) = 'WELD')) Then 'CHL'

```

This also worked fine in Snowflake but gave me a similar error in SSRS:

_ERROR [22023] SQL compilation error: Can not convert parameter '((SUBSTR(SYS\_VW.PROCEDURECODE\_7, 1, 6)) IN (‘183160’, ‘874910’, ‘87491N’)) AND ((RIGHT(SYS\_VW.PROCEDURECODE\_7, 4)) = ‘WELD’) of type [BOOLEAN] into expected type [VARCHAR (16777216)]_

I initially wanted to use an escape character for the commas in the 4 values but I was not able to figure out how to do that.

I noticed that the SSRS message had ‘interpreted’ my Left() function to a SUBSTR() function but don’t know if that means I need to change my LEFT() to SUBSTR()?

I am also not certain what the “type [BOOLEAN]” in the Error Message refers to.

I’d appreciate any help/pointers on how to resolve this.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [December 14, 2023, 3:33pm UTC](https://forums.percona.com/t/ssrs-snowflake-select-filter-column-by-string-with-a-comma-in-it/27144/2 "2023-12-14T15:33:47Z")

</div>

Hi @MOKSHAGNYA_A,  
SSRS is a Microsoft SQL product. That isn’t a database which is open-source like MySQL/MariaDB/PostgreSQL. You might have better luck by posting on a forum that is more targeted at MSSQL-related queries.
