May 24, 2010 at 3:35 pm
i created this SCALAR function
CREATE FUNCTION [dbo].[ufnNickTblPersonOrganizationSuperTypeID](@PersonOrganizationSuperTypeName VARCHAR(10))
RETURNS int
AS
---------------------------------------------------------------------------------------------
-- History of changes:
---------------------------------------------------------------------------------------------------
BEGIN
declare @PersonOrganizationSuperTypeID int
Select
@PersonOrganizationSuperTypeID = PersonOrganizationSuperTypeID
from NickTblPersonOrganizationSuperType(NOLOCK)
Where PersonOrganizationSuperTypeName = @PersonOrganizationSuperTypeName
RETURN @PersonOrganizationSuperTypeID
END
and then i tried to execute it like this;
select * FROM
dbo.ufnNickTblPersonOrganizationSuperTypeID
('MORIN')
but the server throws this error:
Msg 208, Level 16, State 3, Line 1
Invalid object name 'dbo.ufnNickTblPersonOrganizationSuperTypeID'.
could someone tell me what am doing wrong executing it
May 24, 2010 at 3:45 pm
klineandking (5/24/2010)
i created this SCALAR functionCREATE FUNCTION [dbo].[ufnNickTblPersonOrganizationSuperTypeID](@PersonOrganizationSuperTypeName VARCHAR(10))
RETURNS int
AS
---------------------------------------------------------------------------------------------
-- History of changes:
---------------------------------------------------------------------------------------------------
BEGIN
declare @PersonOrganizationSuperTypeID int
Select
@PersonOrganizationSuperTypeID = PersonOrganizationSuperTypeID
from NickTblPersonOrganizationSuperType(NOLOCK)
Where PersonOrganizationSuperTypeName = @PersonOrganizationSuperTypeName
RETURN @PersonOrganizationSuperTypeID
END
and then i tried to execute it like this;
select * FROM
dbo.ufnNickTblPersonOrganizationSuperTypeID
('MORIN')
but the server throws this error:
Msg 208, Level 16, State 3, Line 1
Invalid object name 'dbo.ufnNickTblPersonOrganizationSuperTypeID'.
could someone tell me what am doing wrong executing it
You are trying to use it like a TVF. Try select dbo.yourfunction('value');
May 24, 2010 at 4:06 pm
Thanks it worked i appreciate your help
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply