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 7320 times | 
            
                |  |  |