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 |
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2007-09-24 : 17:26:47
|
Hi I have below sql procedureCREATE PROCEDURE Qty @make as nvarchar(32) ASselect department as category from tblproducts where department = @makeGO Parameter (@make) will get the value from asp.net pageMy Question: Is any possibilities to change the value of parameter when the procedure trigger. Examlpe like belowIf @make = 'Sealed Lead Acid' then I need to pass parameter to the database as 'SLA'elseIf @make = 'Photographic' then 'Multimedia'elseif @make = 'cctv and accessories' then 'security'and so on. I only have six categories. Please helpAdvance Thanks |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-09-24 : 17:44:45
|
| [code]select department as category from tblproducts where department = (CASE WHEN @make = 'Sealed Lead Acid' THEN 'SLA' WHEN @make = 'Photographic' then 'Multimedia' WHEN @make = 'cctv and accessories' then 'security' END) [/code]Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2007-09-25 : 06:56:59
|
| or, you could pass the actual value you need to from the ASP page. Change the VALUE of the dropdown (or radio button or whatever) to what you need, but let the DISPLAY show the other name.[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
Vaishu
Posting Yak Master
178 Posts |
Posted - 2007-09-25 : 08:59:07
|
HiThank you very much. It worksquote: Originally posted by dinakar
select department as category from tblproducts where department = (CASE WHEN @make = 'Sealed Lead Acid' THEN 'SLA' WHEN @make = 'Photographic' then 'Multimedia' WHEN @make = 'cctv and accessories' then 'security' END) Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/
|
 |
|
|
|
|
|