By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,825 Members | 1,258 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,825 IT Pros & Developers. It's quick & easy.

Optional parameter on joined field which could be null?!

P: n/a
I have two tables: eg. a person-table (no nulls allowed), with an id
and so on, and a person_course table (an intermediate table in a
many-to many relationship between person table and courses tables),
with two fields person_id and course_id.

But I want to make ONE multipurpose stored procedure, which has ONLY
optional parameters on all fields in the person table AND the field
course_id in the person_course table.

I have no problems making optional parameters on the person table (eg.
P.ID=ISNULL(@PersonID, P.ID ) ) BUT the problem is, when I try to add
an optional parameter on the field course_id it dosn't produce the
right results. Some times the course_id is null (because some persons
havn't joined a class yet).

Is there a way around it?

Ole S. Pedersen
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
os*@stofanet.dk (Ole S. Pedersen) wrote in message news:<c0**************************@posting.google. com>...
I have two tables: eg. a person-table (no nulls allowed), with an id
and so on, and a person_course table (an intermediate table in a
many-to many relationship between person table and courses tables),
with two fields person_id and course_id.

But I want to make ONE multipurpose stored procedure, which has ONLY
optional parameters on all fields in the person table AND the field
course_id in the person_course table.

I have no problems making optional parameters on the person table (eg.
P.ID=ISNULL(@PersonID, P.ID ) ) BUT the problem is, when I try to add
an optional parameter on the field course_id it dosn't produce the
right results. Some times the course_id is null (because some persons
havn't joined a class yet).

Is there a way around it?

Ole S. Pedersen


http://www.algonet.se/~sommar/dyn-search.html

Simon
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.