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 - 2004-12-15 : 08:27:03
|
| gauravsharma writes "i used procedure and in it a cursor .in procedure i just want to pass the where clause dynamically like WHERE [Amount ($)] > 8 AND MerchantID = 36 Order By [Type] ASC, i did not find any answer yet , plz help me " |
|
|
dsdeming
479 Posts |
Posted - 2004-12-15 : 09:03:01
|
| If you're always going to be filtering on the same two columns--[Amount ($)] and MerchantID--you just need parameters to hold the values that you're filtering on: WHERE [Amount ($)] > @Amount AND MerchantID = @MerchantID Order By [Type] ASC. If the columns aren't the same all the time, you can pass the entire WHERE clause into an sp as a varchar, concatenate it with the rest of the required SQL statement and use either EXECUTE or sp_executesql to run the command.Dennis |
 |
|
|
|
|
|