1

Could anyone shed some light on this error for me? To a beginner of course. This will probably be no more than a simple fix for someone else. I'm trying to read in the Product to be used in the where clause.

alter proc Proc1
@ProductID int
as
go
select ProductName
from Products
where ProductID = @ProductID

enter image description here

1
1

Take out the go after the variable declaration. It is causing SQL server to end the batch which makes your variable declaration go out of scope.

alter proc Proc1
@ProductID int
 as
 select ProductName
 from Products
 where ProductID = @ProductID

Here is some details from Microsoft on what the go keyword/statement does.