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 |
|
tech1
Starting Member
49 Posts |
Posted - 2012-03-27 : 04:36:56
|
| Hi.What is the best way of doing the following:based upon some SPROC params, the results will return either with 0 results or y results.Example: if we search on a postcode/zipcode, it may return 5 addresses. However, another parameter called "exactResultNumber" would be given to the SPROC.this indicates to only return results IF the query will return <= this parameter. If anything more, then dont return results but set an OUTPUT parameter to something... i.e a bit value.how can I do this? What is the best way of doing this rather than having to do a COUNT(...) on the query to determine if it meets <= @exactResultNumber?Thanks |
|
|
rajarajan
Starting Member
48 Posts |
Posted - 2012-03-27 : 05:45:54
|
| i dint get u .. can u post the code or some thing u written |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-27 : 12:03:12
|
| you can capture @@ROWCOUNT value inside a variable after your select statement and check it against the exactResultNumber value. Based on value, you can set OUTPUT parameter or return resultset------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|