I am trying to use this insert query, getting error message sub queries are not allowed in this type, can you please tell me is there any other way to include all of the subqueries. Insert into Tab_ccsNetTaskPercentHistory (percentcomplete, datepctcomplete, divisionid, progid, projid, phase_id, element_id, ContractID, taskid, createdby) values(@PctComplete,@pctCompleteDate,(select top 1 divisionid from Tab_ccsnetTasks WHERE Taskid = @TaskID), (select top 1 progid from Tab_ccsnetTasks WHERE Taskid = @TaskID), (select top 1 projid from Tab_ccsnetTasks WHERE Taskid = @TaskID), (select top 1 phase_id from Tab_ccsnetTasks WHERE Taskid = @TaskID), (select top 1 element_id from Tab_ccsnetTasks WHERE Taskid = @TaskID), (select top 1 contractid from Tab_ccsnetTasks WHERE Taskid = @TaskID),@TaskID,@UserName)
Thank you very much for the help.