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 - 2002-04-18 : 09:43:51
|
| Manu writes "I am trying to write a stored procedure in MS SQL Server. One of the arguments I pass in is an '@operator'(which could be '=', '!=', '<' or '>'). On the basis of this operator I have to write the where clause. Sort of like thisSELECT * FROM EMPLOYEE WHERE payscale '@operator' 25.So if I pass in the argument '=' as @operator it should give meSELECT * FROM EMPLOYEE WHERE payscale = 25.I tried using case statement. It did not work:SELECT * FROM EMPLOYEE WHERE pay case @operatorwhen '=' then =when '!=' then !=end case25PLEASE HELPTHanksManu" |
|
|
graz
Chief SQLTeam Crack Dealer
4149 Posts |
Posted - 2002-04-18 : 09:43:51
|
| Please read the FAQ. Look for the section on dynamic SQL. |
 |
|
|
|
|
|