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 |
|
clarkbaker1964
Constraint Violating Yak Guru
428 Posts |
Posted - 2005-02-16 : 15:29:48
|
I may get toasted for this but here goes.if you name an sp with sp_ and place in the master database with proper permissionsanyone can run this sp no matter what db they are connect to.I want to do the same thing with a handfull of basic functions.Fails like this select fn_varchar_to_int_allownull('10', '6')Server: Msg 195, Level 15, State 10, Line 1'fn_varchar_to_int_allownull' is not a recognized function name.Works like this select master.dbo.fn_varchar_to_int_allownull('10', '6')use mastercreate function dbo.fn_varchar_to_int_allownull(@frontend_int varchar(10), @default_int int)returns intas-- Primary purpose is to format and convert various data types to assist the java front end code begin declare @converted_int int if @frontend_int = '' set @converted_int = null else set @converted_int = isnull(@frontend_int, @default_int)return @converted_intendGOGRANT EXECUTE ON [dbo].[fn_varchar_to_int_allownull] TO [public]GO You can do anything at www.zombo.com |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-02-16 : 15:54:51
|
| As you have found, you will need to use the 3 part naming convention for the UDF. But it can still be called from any database, so I'm not sure what the problem is.Tara |
 |
|
|
clarkbaker1964
Constraint Violating Yak Guru
428 Posts |
Posted - 2005-02-16 : 18:07:27
|
I was hoping that it was similar to calling an sp_ when it follows this naming convention the user does not have to know where it exists it just does.Thank's for the confirmation... Must use 3 part. You can do anything at www.zombo.com |
 |
|
|
|
|
|