Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    London, UK
    Posts
    71

    Question Unanswered: Invalid object name 'dbo.getname' ?

    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 sysadmin
    Last edited by sgmuse; 01-25-06 at 08:44.

  2. #2
    Join Date
    Mar 2004
    Location
    London, UK
    Posts
    71
    got 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •