Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2008-10-25 : 02:42:46
|
| i Had six master tables say tb1,tb2,tb3,tb4,tb5,tb6tb1:id1 int primary key,name1 vrahcr(250) not nulltb2:id2int primary key,name2 vrahcr(250) not nulltb3:id3 int primary key,name3 vrahcr(250) not nulltb4:id4 int primary key,name4 vrahcr(250) not nulltb5:id5 int primary key,name5 vrahcr(250) not nulltb6:id6 int primary key,name6 vrahcr(250) not nullthe relation table tb7 is:id7 int primary keyid1 int references id1id2 int references id2id3 int references id3id4 int references id3id5 int references id5id6 int references id6here i am performing a search query with sp.@p1 int,@p2 int,@p3 int,@p4 int,@p5 int @p6 int are parameters for sp here i need to write a query to satisfy all the condition by checking the parameters if they r null or not:all the combinations need to satisfied:p1,p2,p3,p4,p5,p6,p1&p2,p1&p3,p1&p4 etc.. all combinations.i need to get the name fields in that respective tables id the parameter is not nullplease suggest me a wayOne can never consent to creep,when one feels an impulse to soarRAMMOHAN |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-25 : 02:54:10
|
| so what will you be returing if parameters match coresponding id values? the corresponding names? can you elaborate on that giving sample output for some values passed? |
 |
|
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2008-10-25 : 03:02:58
|
| thank you for replying visakh,yes i want to return names. sampleo/p:name1 x if @p1 contains a matching value n all other r nullname1 name3x y if @p1&@p3 contains a matching values n all others r nulletc...One can never consent to creep,when one feels an impulse to soarRAMMOHAN |
 |
|
|
|
|
|
|
|