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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-05-21 : 07:40:25
|
| Bhupendra Singh writes "Hi,I want to execute different sql queries based on the valuespassed by the parameter. It will give me the flexibility tohave a single stored procedure returning different resutlsdepending on the value of parameter.Vb and other programming languages allow us to useCase Statements (if depending on the value of one variabledifferent statements will execute) instead of using multipleif conditions.Can Sql Server has any statement to reduce multiple if conditions. Remember, I would like to write multiple lines of code between each case.Thanks in advance.Warm Regards,Bhupendra Singh" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-05-21 : 08:00:35
|
| Yes, T-SQL has several Control-of-Flow constructs. If you want to return different row-sets based on you input param, use a if...else construct. If the row-set to be returned is the same, then you maybe be able to use CASE to evaluate your conditions in the WHERE clause or integrated into the SELECT list.Jay White{0} |
 |
|
|
|
|
|