someone please help me?
i've made this used-defined function and sql won't let me use it,
CREATE FUNCTION dbo.getname (@.sname varchar(255))
RETURNS TABLE
AS
RETURN
SELECT ISNULL((select (c.firstname + ' ' + c.surname) from contacts.dbo.c_contact as c where c.employ_ref LIKE @.sname), @.sname) as FullName
using it,
select dbo.getname(c.EMPLOY_REF)
from c_contact as c
but everytime i try to use it i get,
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.getname'.
what's wrong with it?, i should have rights, i am set as sysadmingot it to work,
CREATE FUNCTION dbo.getname (@.sname nvarchar(255))
RETURNS nvarchar(255)
AS
BEGIN
DECLARE @.ss as nvarchar(255)
SET @.ss = (
SELECT ISNULL((select (c.firstname + ' ' + c.surname) from contacts.dbo.c_contact as c where c.employ_ref LIKE @.sname), @.sname) as FullName
)
RETURN(@.ss)
END
No comments:
Post a Comment