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 |  
                                    | chennaraajStarting Member
 
 
                                        17 Posts | 
                                            
                                            |  Posted - 2014-04-01 : 02:46:51 
 |  
                                            | Hi All,I am having table Employee with Employee Salaries details,from that i need to get the values based on parameters(@Param1,@Param2)select * from Employeewhere Salaries >@Param1 and Salaries < @Param2Conditions : 1) @Param1 >10000 and @Param2 <250002) @Param1 >10000 and @Param2 =''3) @Param1 <15000 and @Param2 =''(may or may not pass the values for @Param2)regards,RKrk |  |  
                                    | gbrittonMaster Smack Fu Yak Hacker
 
 
                                    2780 Posts | 
                                        
                                          |  Posted - 2014-04-07 : 15:05:51 
 |  
                                          | I assume one condition is sufficient?  Then something like this should do it:Assuming that in all cases the salary must be greater than @param1 and @param2 is optional.  Also assuming that you pass the parameters as varchars, something like this might do it. select * from Employeewhere Salaries > @Param1  and (coalesce(@Param2, '') <> '' and Salaries < @Param2))   or (coalesce(@Parame, '') = '') |  
                                          |  |  |  
                                |  |  |  |