>I am updating a CTE but cannot then select the rows:
>with MyCte as (Select * from MyTable)
>update MyCte set MyField = '111'
>...... works ok
>
>
>with MyCte as (Select * from MyTable)
>update MyCte set MyField = '111'
>Select * from MyCte
>......Gives Invalid Object name near cte
>
>Above is a simple example of what I am trying to do.
>I am hoping to use Common Table Expressions similar to Writable Cursors in VFP
>
>Tia
>Gerard
Gerard,
Common Table Expression can only be used immediatelly after its declaration. Your sample above doesn't make must sense, what exactly you're trying to do?
Also take a look at the OUTPUT clause of the UPDATE command.
If it's not broken, fix it until it is.
My Blog