Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Function call ambiguous

Author  Topic 

dani2
Starting Member

32 Posts

Posted - 2008-02-15 : 05:39:32
How can I use/call a SQL function if it is saved with same name under Other Functions and Security Functions. Calling its name I get an ambiguous error message.

thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-15 : 05:40:47
You can use a schema.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-15 : 05:40:48
Not sure what you are saying. Can you elaborate more with some example code?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-15 : 05:42:51
I think he means that he created an udf with same name as an already present under

System Functions -> Other Functions.

Prefix your function with correct schema name.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

dani2
Starting Member

32 Posts

Posted - 2008-02-15 : 05:44:43
In one database in System Functions there is a function called User_Name under Security Functions and also under Other Functions.
When I try to call this function in a query a get an ambiguous error message. How can I call explicit to one of these functions?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-15 : 05:46:07
Post the query here. And the error message.




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-15 : 05:48:06
This is also a way to get "Ambiguous" error message.
SELECT		Number
FROM master..spt_values AS v1
INNER JOIN master..spt_values AS v2 ON v2.Type = 'p'
WHERE v1.Type = 'p'
If I put either table alias v1 or v2 before Number column in the SELECT part, the query works.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-15 : 08:07:12
Or is your function a TABLE VALUED FUNCTION, and you SELECT it as a normal column?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -