How to write a foreach in SQL Server?

后端 未结 10 2144
没有蜡笔的小新
没有蜡笔的小新 2020-12-12 08:39

I am trying to achieve something along the lines of a for-each, where I would like to take the Ids of a returned select statement and use each of them.

DECLAR         


        
10条回答
  •  天命终不由人
    2020-12-12 09:12

    Although cursors usually considered horrible evil I believe this is a case for FAST_FORWARD cursor - the closest thing you can get to FOREACH in TSQL.

提交回复
热议问题