Невозможно назначить переменную в select (процедура хранения)
ALTER procedure [dbo].[spDepartmentWorkingSelectAll] as set nocount on declare @SAM float declare @factor_error float select [id], [date_working], [department_id], (select top 1 departments.name from departments where departments.id = department_id) as department_name, [employee_count], [product_quantity], [real_time], [labor_unit], [product_id], (select top 1 products.code from products where products.id = [product_id]) as product_code, [product_quantity_error], @SAM = dbo.fnSam([product_id]), -- SAM @SAM as sam, @factor_error = dbo.fnFactorError([product_id],[product_quantity],[product_quantity_error]), -- factor error @factor_error as factor_error (@SAM * 60)/2 as real_output , @SAM * @factor_error as reward_unit ((@SAM + @factor_error) * 8)/32 as expected_output from [department_working]
Что я уже пробовал:
я хочу назначить переменную в select stament для работы, но моя процедура хранения в sql server 2008 не может быть запущена. все, Пожалуйста, помогите мне. спасибо