Xpode.com        Click here to Print this article.

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



http://
http://

Contributed by:
Rohit kakria
I am software developer

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=486

Click here to go on website