i am fighting with `with clause` two return a result set as well as set a sql variable too.
Or somehow i just want to get two results from the `with clause`.
My sql query is:

```
declare @total as int

;with T as
(
    // some sql query
)
select * from T

```

above query returning a set of result, But i also want to set `@total` (number of rows in T).  

Is this possible ? Thank you

Here is also a way two do this like :

```
;with T as
    (
        select count(1), * from table1
    )
    select * from T

```

But its not a appropriate way to do this, Because it will return the `count` as `column`.
['https://Stackoverflow.com/questions/19581247', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1658099/']
```
 //try this
 - (void)searchBarSearchButtonClicked:(UISearchBar *)sBar
 {
      [sBar resignFirstResponder];
 }

```
**Here is the solution:**

```
- (void)viewDidLoad
{
    [super viewDidLoad];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard)];
    [self.view addGestureRecognizer:tap];
}

```

**You need the UI field to resign the first responder status to dismiss the keyboard.**

```
- (void)dismissKeyboard
{
   [searchBar resignFirstResponder]; //It might not work

```

**or**

```
[field resignFirstResponder]; //it will surely work
}

```