Why my SQL Server stored procedure can not see my function?

Posted on 2009-12-21
Last Modified: 2012-05-08
Dear Expert, I create a function fn_Gender with 2 parm returning a table called gender. After I created the function and tried to test the function, I wrote "select * from dbo.gender (1,2). the function name is red, The message said:"Invalid Object Name dbo.fn_Gender." when I run it, it returned me the correct results. But when I use a stored procedure to call this function, The stored precedure returned the same message and could not run.
Please help!
Question by:johnyue
    LVL 75

    Expert Comment

    by:Aneesh Retnakaran
    make sure that you created the function on the proper database with 'dbo.'  prefix ,also make sure you are running the query on the same database

    Author Comment

    Yes, I did that, there are more then one fns I am using when I create this one and refreshed the Function tab, The function showed at the same place where the other fns are. But when I tried to call it from my procedure. I typed in "dbo." in my procedure. the other fns showed up but this new one did not.
    LVL 75

    Expert Comment

    by:Aneesh Retnakaran
    may be you didnt run that function

    Author Comment

    What do you mean by "run"?
    LVL 75

    Accepted Solution


    its possible that you type the content of the function , but didnt "run" that by pressing F5 .. try recreating the function


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
    In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now