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.
| Author |
Topic |
|
ts_abbott@hotmail.com
Starting Member
36 Posts |
Posted - 2004-11-29 : 11:59:54
|
| I need to call a udf in another database - is this possible?This works...USE PostCodeSELECT dbo.CalcDistance('AB12 3CD, 'EF4 5GH')This doesn't...USE MyDBSELECT PostCode..CalcDistance('AB12 3CD, 'EF4 5GH') |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-11-29 : 12:08:29
|
| [code]USE NorthwindGOSET NOCOUNT ONGOCREATE FUNCTION myUDF99 (@x int)RETURNS intAS BEGIN DECLARE @y int SELECT @y = @x * 2 RETURN @y ENDGOSELECT dbo.myUDF99(2)USE PubsGOSELECT Northwind.dbo.myUDF99(2)GOUSE NorthwindGOSET NOCOUNT OFFDROP FUNCTION myUDF99GO[/code]Brett8-) |
 |
|
|
ts_abbott@hotmail.com
Starting Member
36 Posts |
Posted - 2004-11-29 : 12:27:28
|
| thanks Brett, I thought you needed two dots (i.e. Northwind..) when referencing different databases. cheers. |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-12-01 : 02:27:22
|
| you need to include the owner name when referencing objects outside the current database.database.owner.object, else it's database..object wherein sql assumes it's owner is dbo.--------------------keeping it simple... |
 |
|
|
|
|
|