I have a table variable in a script (not a stored procedure). Two questions:
Here's my code:
Declare @projectList table(
name varchar(40) NOT NULL);
Insert Into @projectList
Values ('BCR-00021')
Select *
From @projectList
Drop Table @projectList -- does not work
Table variables are automatically local and automatically dropped -- you don't have to worry about it.