I have a table called CourceInstance which includes a Period and a Year attribute. I am trying to put the values of Period attribute from CourseInstance into my table variable. It can run without a problem however every time I run the EXEC @tablePeriod part or the whole code it gives me the error:
Must declare the scalar variable "@tablePeriod".
What can the problem be of? @tablePeriod is already declared.
DECLARE @tablePeriod TABLE ( Period INT ) INSERT INTO @tablePeriod (Period)
SELECT Period FROM CourseInstance WHERE Year = 2015
EXEC @tablePeriod
EXEC @tablePeriodto do? I'm genuinely unable to guess what your intention was here.