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 |
|
avmreddy17
Posting Yak Master
180 Posts |
Posted - 2006-08-29 : 11:33:16
|
| SenderCompID OnBehalfOfCompID SenderSubID AccountID FirmCodeExternal AccountIndexI have the above five Columns in table and I need a SPwhich will take SenderCompID OnBehalfOfCompID SenderSubID AccountID as I/P parameters and in the table the I/p Parameters might have values in the four Colums or just one Column or two or threeand ReturnFirmCodeExternal AccountIndexDataSenderCompID OnBehalfOfCompID SenderSubID AccountID FirmCodeExternal AccountIndexT1 NULL T2 NULL XXX 1If any one of the I/P parameters matches I need to return FirmCodeexternal and AccountIndexThanks for any help on thisThxVenu |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-08-29 : 11:39:52
|
| create proc x@SenderCompID int ,@OnBehalfOfCompID int ,....asselect FirmCodeExternal, AccountIndexfrom tblwhere (SenderCompID = @SenderCompID or @SenderCompID is null)and (OnBehalfOfCompID = @OnBehalfOfCompID or @OnBehalfOfCompID is null).....go==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-08-29 : 11:49:14
|
| orwhere Isnull(@SenderCompID,SenderCompID)=SenderCompID and Isnull(@OnBehalfOfCompID ,OnBehalfOfCompID )=OnBehalfOfCompID MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|