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 |
|
sqlnovice123
Constraint Violating Yak Guru
262 Posts |
Posted - 2010-03-09 : 01:49:34
|
| HiI have a parameter lookup proc that stores the key as a numeric and value as a string.I am passing varios parameters and among them are @ClientType declared as a varchar(50) and @Product declared as a varchar(50). I am passing the below key value 154194 for @ClientType and 154193 for @Product.I would like the stored procedure to display the string value in the final output.Currently I do not have the two values displayed in the output.I tried the following: I want to store the string eqivalent value of ClientType for the int paramete value @ClientType being passed to the proc. I want the string value to display in output.If @ClientType is passed 154193, the corresponding ClientType is 'Broker-Dealer'.How can I achieve this? I thought storing the column value in a temp table and then joining to the temp table in the final select can do this but I get many rows because of the join.So if I have ClientType and Product stored as string values in a #temp table how can I output the values?CREATE TABLE #ClientTBL( ClientID binary(8), ClientType varchar(50))INSERT #ClientTBL( ClientID, ClientType )SELECT DISTINCT dlr.Company_Id, dlr.MA_TypeFROM pivotal..Company dlr WHERE dlr.MA_Type IN (SELECT PARAM_VALUE FROM MARPTGEN_PARAMLIST WHERE PARAMLIST_KEY = @ClientType )example: for columnsPARAMLIST_KEY, PARAM_VALUE, PARAM_PERSIST154194 Emerging Markets 1154194 Floating Rate Notes 1154194 High Grade 1154193 Issuer 0154193 Investors 0154193 Investment Manager 0154193 Investment Co 0154193 Investment Advisor/Private Bank 0154193 Investment Advisor 0154193 Internal Dealer Group 0154193 Insurance/Reinsurance Co. 0 |
|
|
|
|
|