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?)
You can use
ORin yourwhereclause since it can be any of the two columns.