ALTER function [dbo].[getEmployeeID](@ID int) returns table
as
begin
return (
select * from [dbo].[gtEmployeeName](2)
select * from Employees where EmployeeID = @ID)
end
here [dbo].[gtEmployeeName] is an other function that I am trying to call.
I am getting an error, can we call or is there any syntax problem?
Msg 156, Level 15, State 1, Procedure getEmployeeID, Line 6
Incorrect syntax near the keyword ‘select’.
Msg 102, Level 15, State 1, Procedure getEmployeeID, Line 6
Incorrect syntax near ‘)’.
Thanks
Prince
If
[dbo].[gtEmployeeName]returns scalar you probably are looking forIf
[dbo].[gtEmployeeName]returns table you probably are looking forUpdate the join to outer if that is what you need. Also update the
join condition(the example assumes that the returned table fromgtEmployeeNamehas a columnEmployeeIDand that can be used for joining to Employees.