October 3, 2004 at 8:50 am
hiya,
I want to copy the above from one sql2k database to another.I tried copying and pasting in EM.But it didn't work
Is there away to:
1) ideally add these udf's as default to a every new database that I create?
2) at least be able to copy them from database to another?
many thanks..
yogi
October 3, 2004 at 10:56 am
Hi Yogi,
It sounds like almost all your databases will be using the UDF functions.
Maybe, it might be less work if you just create the functions once in the master database. This way, the functions may be reused by all the databases.
Then, to call the function from any database, you would include master in front like this: master..fn_myFunction(..)
Hope this helps.
Regards,
JP
October 3, 2004 at 12:29 pm
you're dead right,
I never knew I could do that, cheers.
here's a wee clip from BOL
<clip>
If a user-defined data type is created in the model database, it exists in all new user-defined databases. However, if the data type is created in a user-defined database, the data type exists only in that user-defined database.
the model database, it exists in all new user-defined databases. However, if the data type is created in a user-defined database, the data type exists only in that user-defined database.
<\clip>
Handy..However, I still don't know how to MOVE my udf's:
FROM my current database
TO the master database.
Can anyone advise?
cheers,
yogi
October 3, 2004 at 5:04 pm
Hi Yogi,
Try out these steps:
1) Have Enterprise Manager generate a CREATE script of the UDF functions you want to move
2) Copy the generated script code
In SQL Query Analyzer:
3) Paste the script code
4) Select master as the database
5) Execute the script
Regards,
JP
October 3, 2004 at 11:45 pm
Or....
Using EM, copy (right click on existing UDF), move on over to Master/UDF's. Right Click "Create new UDF" clear the code window and paste into the code window.
When EM does the Copy it copies the Script to generate the object into the clipboard.
The systems fine with no users loggged in. Can we keep it that way ?br>
October 4, 2004 at 3:13 am
Placing objects, making changes, users etc. within the model database will place these within each new user database you create on the server.
Right click on object in EM to script objects
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
October 4, 2004 at 6:28 am
ta folks, that did the trick.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply