Link to home
Start Free TrialLog in
Avatar of johnyue
johnyue

asked on

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
Avatar of Aneesh
Aneesh
Flag of Canada image

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
Avatar of johnyue
johnyue

ASKER

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.
may be you didnt run that function
Avatar of johnyue

ASKER

What do you mean by "run"?
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial