I written the following function.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create FUNCTION NameFunction
(
@eid int
)
RETURNS varchar
AS
BEGIN
Change your RETURN type to include a length, at this point it is just returning 1 character:
RETURNS varchar(100)
Full code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create FUNCTION NameFunction
(
@eid int
)
RETURNS varchar(100) -- or whatever length you need
AS
BEGIN
Declare @logid varchar(50);
SELECT @logid = E.LoginId from HumanResources.Employee As E
where E.BusinessEntityID = @eid
RETURN @logid
END
GO