How to write a foreach in SQL Server?

后端 未结 10 2140
没有蜡笔的小新
没有蜡笔的小新 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:33

    The following line is wrong in your version:

    WHILE (@i <= (SELECT MAX(idx) FROM @Practitioner))
    

    (Missing the @)

    Might be an idea to change your naming convention so that the tables are more different.

提交回复
热议问题