bfuchs
asked on
how to convert the following udf function into a stored procedure?
Hi Experts,
Can someone help me convert the following function into a stored procedure?
Can someone help me convert the following function into a stored procedure?
CREATE FUNCTION [dbo].[fnOrientLastNoteID]
(
@Orientationid AS int
)
RETURNS int
AS
BEGIN
DECLARE @Result AS int
select @Result = MAX(ID)
FROM dbo.OrientationNotes
where OrientationID = @OrientationID;
--GROUP BY OrientationID -- you don't need to group
RETURN @Result;
END
GO
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks you guys,
Perhaps you may as well know how can I get that to work in my Access App form?
See following.
https://www.experts-exchange.com/questions/28659574/How-to-call-a-sql-custom-function-from-an-Access-project.html?anchorAnswerId=40735042#a40735042
Perhaps you may as well know how can I get that to work in my Access App form?
See following.
https://www.experts-exchange.com/questions/28659574/How-to-call-a-sql-custom-function-from-an-Access-project.html?anchorAnswerId=40735042#a40735042
No worries... however just curious why did you choose ScottPletcher answer over mine.. Our answers were identical and I posted first?
ASKER
Sorry, I meant to assign 400 for your answer
Already requested attention on this matter.
Already requested attention on this matter.
ASKER
Corrected, Apologize for that..
(
@Orientationid AS int
)
AS
SET NOCOUNT ON;
SELECT MAX(ID)
FROM dbo.OrientationNotes
WHERE OrientationID = @OrientationID
GO