The multi-part identifier "dbo.ufnGetAccountingEndDate" could not be bound.

  • Hi Folks,

    I am experimenting with functions on a SQL Server 2014 box and with the AdventureWorks2014 database.

    Within the database is a function called 'ufnGetAccountingEndDate' and no parameters need to be passed to it.

    To execute the function I run as a member of the SYSADMIN group....

    SELECT ufnGetAccountingEndDate

    ....while in the correct database context.

    Unfortunately the execution results in the following error:

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "dbo.ufnGetAccountingEndDate" could not be bound.

    I have no idea what the problem could be.

    I have tried:

    1. Checking syntax and semantics

    2. Ensuring permissions on the database are appropriate

    3. Using Intellisense to search for the function (it also couldn't see it!)

    Although the function is most definately there, I can't find a way to reference it.

    I owuld be grateful for any help you could offer!

    Regards,

    Kev

  • SELECT dbo.ufnGetAccountingEndDate()

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (9/18/2015)


    SELECT ufnGetAccountingEndDate()

    Beat me to it.

    What I would also suggest is that you always schema-qualify your DB objects:

    select dbo.ufnGetAccountingEndDate();

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Phil Parkin (9/18/2015)


    GilaMonster (9/18/2015)


    SELECT ufnGetAccountingEndDate()

    Beat me to it.

    What I would also suggest is that you always schema-qualify your DB objects:

    select dbo.ufnGetAccountingEndDate();

    Whoops.

    Functions MUST be schema-qualified.

    I suspect Kev did schema-qualify his code and just omitted the dbo. when posting, as

    SELECT FunctionName

    returns

    Msg 207, Level 16, State 1, Line 1

    Invalid column name 'FunctionName'.

    while

    SELECT dbo.FunctionName

    returns

    Msg 4104, Level 16, State 1, Line 1

    The multi-part identifier "dbo.FunctionName" could not be bound.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi Gail and Phil,

    now I feel like a numpty! Funny thing really......now it works! 😀

    Thanks for your time and help.....

    Regards,

    Kev

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply