March 24, 2009 at 4:15 am
Hi
Is it possible to call a stored procedure in order to calculate a column in a SELECT query?
Something like:
SELECT EmployeeID, EmployeeName
,EXEC spCalculateTax(p1, p2, p3)
FROM Employees
Thanks.
March 24, 2009 at 4:29 am
Hi
Guideline for calculations in SELECT section is a scalar user defined function instead of a procedure. It may be possible to call a procedure with OPENQUERY but maybe have a look for functions.
Greets
Flo
March 24, 2009 at 4:41 am
We cannot directly call a stored procedure like that in a select statement, if possible try converting the proc to a function and use it.
Or
If youur main select query is in a stored proc, try getting the data returned by stored proc into a table of sorts and join the result sets.
Sriram
March 24, 2009 at 5:02 am
Great thanks all!
....and what is the correct syntax for calling the function in my select statement? I want the result of the function to be placed in a column.
March 24, 2009 at 5:04 am
ah its ok...I worked it out.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply