Question: I was just supposing that I could put a `set query` within `WITH` statement in SQL Server 2008.

So I wrote a few lines of code:

```
with temp as   
(
    SELECT row_number() OVER (ORDER BY [ShareItems].ItemId) AS Row, ItemId FROM [ShareItems]
)
set @row = ItemId //<---error

```

but I am getting an error above, but in case of `select` statement using `WITH` keyword, there was no error???

```
with temp as   
(
    SELECT 
        row_number() OVER (ORDER BY [ShareItems].ItemId) AS Row, ItemId 
    FROM [ShareItems]
)
SELECT ItemId 
FROM temp //<--- OK (no error)

```

Any suggestion ?

Answer: 
You can use 

```
CGContextDrawPath(context, kCGPathFillStroke);

```

instead of

```
CGContextFillPath(context);
CGContextStrokePath(context);

```

The problem is that both `CGContextFillPath()` and `CGContextStrokePath(context)`
*clear* the current path, so that only the first operation succeeds, and the second
operation draws nothing. `CGContextDrawPath()` combines fill and stroke without
clearing the path in between.
When you stroke or fill the path in the context, the context removes the path for you (it expects that it's work is done). You must add the path again if you want to fill it after stroking it.

It's probably best to create a `CGPathRef path` local variable, build the path, add it, stroke, add it again, fill.

```
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, nil, 20, viewHeight-19.5);
CGPathAddLineToPoint(path nil, 200, viewHeight-19.5); // base
CGPathAddLineToPoint(path nil, 300, viewHeight-119.5); // right border
CGPathAddLineToPoint(path nil, 120, viewHeight-119.5);
CGPathAddLineToPoint(path nil, 20, viewHeight-19.5);

CGContextAddPath(context, path);
CGContextFillPath(context);

// possibly modify the path here if you need to

CGContextAddPath(context, path);
CGContextStrokePath(context);

```