Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8242097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:03:33+00:00 2026-06-07T21:03:33+00:00

The following param below would look something like (2,3,4,5) or (2) or even be

  • 0

The following param below would look something like (2,3,4,5) or (2) or even be NULL the column ServiceEntryPart could have data as below in the code section. My question is what will be the correct syntax so I could use the filter. If the filter is NULL, I will totally ignore it. What I have so far works fine if its a NULL (Excludes the filter) but when I have the param for example (1,2), it does not work.. Thanks

ServiceEntryPart.ServiceTypeIDs 
 4,3
 3
 NULL
 1
 8
 2,5

--Filter:
  @ServiceTypes nvarchar(100) = NULL

--Filter with values SET @ServiceTypes = (1,2,4,5)      

--Where Clause  
WHERE   (ServiceEntryPart.ServiceTypeIDs = ISNULL(@ServiceTypes,ServiceEntryPart.ServiceTypeIDs)   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:03:35+00:00Added an answer on June 7, 2026 at 9:03 pm

    It looks like you want to pass in a variable list for an IN clause. One way is with dynamic SQL, but I would say that is overkill.

    You can try something like:

    where @ServiceTypes is null or
          charindex(','+cast(ServiceEntryPart.ServiceTypeIDs as varchar(255)+',',
                    ','+@ServiceTypes+',') > 0
    

    This is using a string search to do the equivalent of IN. It assumes that @ServiceTypes is a comma delimited list with no spaces. It prepends and postpends a comma. When you look for something like 5, it really looks for “,5,” so it does not match 25 or 55 in the list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following code function myFunction(param, callback) { ... if (err) {
I have the following JavaScript code: var x = ['CFMG','JMFMG','CPMAF']; var y = $.param({'test':x});
Let's say I have the following code: class MyClass(object): def __init__(self, param): self.param =
I would like to do something like the following: if params[:entry].include? (http || www
I have following XML configration i would like to convert to java property file.
The following keeps returning null any idea why <ui:param name=dialogName value=#{index.toString().concat('Overlay')} />
i have a flash video called abc.swf that i would like to play when
I have a joinable pthread runner function defined as below: void *sumOfProducts(void *param) {
Using the C# code below, how would you write it in Visual Basic? What
I have the following code: private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); XmlConfigurator.Configure(new FileInfo(log4net.config));

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.