Conditional Join?
From: Brian (brian_at_nospam.com)
Date: 01/10/05
- Previous message: Torquin: "Re: Automatically Create Linked Server?"
- Next in thread: Hal Heinrich: "RE: Conditional Join?"
- Reply: Hal Heinrich: "RE: Conditional Join?"
- Reply: Hugo Kornelis: "Re: Conditional Join?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 Jan 2005 16:42:19 -0500
I currently have a stored proc that is dynamic. I build it up based in a
variety of variables passed in. I would like to move away from this if
possible.
I have one sticking point, I have a series of statements like this
if @language_id <> 'NA'
BEGIN
set @joins = @joins+' JOIN c_language_skills ls ON c.candidate_id =
ls.candidate_id'
set @where = @where+' AND ls.language_id IN ('+@language_id+')'
END
Is it possible to use a CASE statement or maybe COALESCE ?
The join is optional because the user didn't need to query, in this case, on
the language skills. If I used Coalesce and had Null would it query all
the rows or ignore it?
Hope that makes sense.
Thanks
- Previous message: Torquin: "Re: Automatically Create Linked Server?"
- Next in thread: Hal Heinrich: "RE: Conditional Join?"
- Reply: Hal Heinrich: "RE: Conditional Join?"
- Reply: Hugo Kornelis: "Re: Conditional Join?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|