From: Uri Dimant on
Hi
Windowed functions can only appear in the SELECT ... As Gert pointed you can
use ROWCOUNT or insert the data by using output clause into another table
and issue SELECT COUNT () to get row count









"SnapDive" <SnapDive(a)community.nospam> wrote in message
news:0mg8o5d9tvp1pcpta1j9sb34t9d8cabu3i(a)4ax.com...
>
> Using SQL Server 2005, I would like to do a delete statement and
> simply capture the number of rows affected by the delete to an int so
> I can write that message to a global temp table.
>
> Something like the below, but actually working. :)
>
> -- ##globaltemp already exists
> declare @counttable ( curr int )
>
> delete from mytable where someid < 1000
> select count (output deleted.* ) into @counttable
> select 'deleted: ' + tt.curr into ##globaltemp from @counttable tt
>
>
> How can I do this using outout instead of using ROWCOUNT ?
>
> Thanks.