Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.

Reason of this error

This error occurs when you are assigning the column values from a SELECT statement into local variables but not all columns are assigned to a corresponding local variable.

Example: When you returning a table or multiple values from a table or any procedure, then in select statement all values must be assigned.

DECLARE @name NVARCHAR(40)

SELECT @name = Name,
       [Age]
FROM [dbo].[tbl_employee]
WHERE [employee_code] = 'AVF'

Error will come because age is not assigned to any value.

If you will comment this then error will be solved

Share this article   |    Print    |    Article read by 6234 times
Author:
Rohit kakria
I am software developer
Related Articles: No related article
Related Interview Questions: No related interview question