Saturday 4 March 2017

SQL Server - Fix Error -Must declare the scalar variable "@ID".


Watch this on YouTube

Msg 137, Level 15, State 2, Line 6
Must declare the scalar variable "@ID".

To Fix it - replace

Declare @ID  int = (Select Top 1 ID From Customers Where [FisrtName] = 'Bob')
GO

Select @ID

with

Declare @ID  int = (Select Top 1 ID From Customers Where [FisrtName] = 'Bob')

Select @ID

No comments:

Post a Comment