How do I drop table variables in SQL-Server? Should I even do this?

前端 未结 7 1932
执笔经年
执笔经年 2020-12-12 18:58

I have a table variable in a script (not a stored procedure). Two questions:

  1. How do I drop the table variable? Drop Table @varName gives an \"Incorrect snyta
7条回答
  •  独厮守ぢ
    2020-12-12 19:04

    But you all forgot to mention, that if a variable table is used within a loop it will need emptying (delete @table) prior to loading with data again within a loop.

提交回复
热议问题