Copy function from one DB to other DB | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Copy function from one DB to other DB

Hi All, I have 10 functions located in DatabaseI. I need to copy those functions in other database called databaseII. How to copy those functions from DatabaseI to DatabaseII.
Thank u With Regards Aruna Mathew
Script it & run it on the other DB
or run this in one DB; copy the result and change to other Db and run there
select text from syscomments C
inner join sysobjects S on where S.xtype=’Fn’
Madhivanan Failing to plan is Planning to fail
I would rather choose scripting method that accessing the system tables intermittently. Satya SKJ
Contributing Editor & Forums Moderator
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Madhivanan, The "text" column from syscomments is actually just 4000 characters wide. If the script is longer than 4000 characters, then the definition of the object is recorded on multiple rows – just look at the colid column. So at the least, your suggestion should also include an ORDER BY [id], [colid].
… and there’s always the problem of words broken off at the end of the 4000 characters, continuing on the next row.
Thanks Adriaan [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />Madhivanan<br /><br />Failing to plan is Planning to fail