?
Solved

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

Posted on 2009-12-21
5
Medium Priority
?
203 Views
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!
John
0
Comment
Question by:johnyue
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 26100840
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
0
 

Author Comment

by:johnyue
ID: 26100879
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.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 26100900
may be you didnt run that function
0
 

Author Comment

by:johnyue
ID: 26101906
What do you mean by "run"?
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 26105577
johnyue,

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


Aneesh
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

840 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