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

前端 未结 7 1933
执笔经年
执笔经年 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:25

    if somebody else comes across this... and you really need to drop it like while in a loop, you can just delete all from the table variable:

    DELETE FROM @tableVariableName
    
    0 讨论(0)
提交回复
热议问题