Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Sql: why delete top (1) from table does not work in store procedure?

$
0
0

Inside store procedure, we try to delete top row from a table @Table

Declare @Temp Table (ItemNumber int Primary key)

Insert into @Temp

select 1

Union

Select 2

Delete Top (1) From @Temp

select * from @Temp

we separately try above bold lines code, it works,

However, when this section script inside store procedure, it does not work.

The section code is actually inside a cursor. Does cursor cause any problem?

Anyone know what is reason? Thx!


JaneC


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>