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

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
johnyueAsked:
Who is Participating?
 
Aneesh RetnakaranDatabase AdministratorCommented:
johnyue,

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


Aneesh
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
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
 
johnyueAuthor Commented:
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
 
Aneesh RetnakaranDatabase AdministratorCommented:
may be you didnt run that function
0
 
johnyueAuthor Commented:
What do you mean by "run"?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.