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

  • SEARCH
  • Home
  • 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 8528583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:50:02+00:00 2026-06-11T08:50:02+00:00

I have created a SP to return some customer data for one company. I

  • 0

I have created a SP to return some customer data for one company. I am passing company id and the customer id in to the SP. There are two types of customer ids in the table I am querying. The two types are saved in different columns.

For an example say I have the following columns in my table.

ID,Comments,CustomerTypeAId,CustomerTypeBId

Either of the customer IDs can be null in one row. The customer Id I am passing in to the SP could be a Type A customer or Type B customer. So in my WHERE clause I need to specify if the CustomerTypeAId is null then query the CustomerTypeBId.

@CusId int=0
SELECT * FROM TEST
WHERE (How to put this part?)
  • 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-11T08:50:03+00:00Added an answer on June 11, 2026 at 8:50 am

    You can use OR in your where clause since it can be any of the two columns.

    SELECT * 
    FROM   TEST
    WHERE  CustomerTypeAId = @id OR
           CustomerTypeBId = @id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a web service which returns some data and am trying to
I have created a EF 4 & C# to get some data. I am
I have created a custom method that will return unique items, together with the
I have created a function that will return the string path from my DB.
I have created a dictionary in Class A and would like to return the
I'm using MS SQL 2005 and I have created a CTE query to return
I have a stdClass object created from json_decode that won't return the right number
Using xlwDotNet, I have created a simple function which returns one number. Sometimes, something
I want to display customer information. Then I created some classes; Customer, Delivery, Order,
I have created an entity data model from my database. however in certain areas

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.