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 3963084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:10:23+00:00 2026-05-20T03:10:23+00:00

Facing problem for generating SQL Server Query In the Following query dynamic conditions are

  • 0

Facing problem for generating SQL Server Query
In the Following query dynamic conditions are added to check whether value is null or not

Select  * 
From    tblEmployees 
where   EmployeeName =  Case 
                            When @EmployeeName Is Not Null 
                                Then @EmployeeName 
                            Else EmployeeName 
                        End 

But I need to add IN () Conditions and the parameter with in the IN () could be null or blank also ,if the parameter /string which is passed to the IN condition is blank then i donot want to add that condition in the query.

So how can i Achieve this.A helping hand will be very useful for me.

Thanks and Regards,
D.Mahesh

  • 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-05-20T03:10:23+00:00Added an answer on May 20, 2026 at 3:10 am

    Depending on value of your parameter (blank of not), you can create SQL string accordingly.

    DECLARE @sqlCommand VARCHAR(1000)
    IF(ISNULL(@YourParameter,'')='')
        @sqlCommand = 'your query goes here'
    ELSE
        @sqlCommand = 'your query goes here'
    

    and then, run it using dynamic query execution

    EXEC (@sqlCommand)
    

    If not dynamic query then,

    SELECT ....
    FROM ....
    WHERE CASE WHEN ISNULL(@YourParameter,'')='' THEN '' ELSE EmployeeName END IN (ISNULL(@YourParameter,''))
    

    See if this works…

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

Sidebar

Related Questions

I am facing problem in query string. Following is my asp code <asp:Label ID=Lable1
I am facing problem while generating CAB file. I want to customize the INF
I was facing this unique problem of generating a bit-mask based on the input
I am facing problem to get variable from query string. I have used htaccess
I am facing some problem in generating oauth_signature for flickr api. Can you please
I am facing a problem with FPDF while generating the PDF file with images
I have facing problem in listview i am getting data from server and after
I am facing problem to set a perticulat value of a custom JComboBox. If
i am facing problem with the return type for this function and not really
I am facing problem on a centOS server while sending java mails. Getting the

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.