How I can restore only the SP and Userdefined functions of a db

  • There is any easy method to restore only the stored procedures and functions of a db

    Thanks in Advance

  • Hi,

    If you have backups made with a product like litespeed, yes, you can 'restore' (that is, script out) stored procs, functions etc from a backup file. With native SQL backups, though, I think you'd have to restore the database somewhere, then script the items out from that.

    HTH

    J

  • Indeed, the only way you can do this with the standard tools of sqlserver is by restoring the backup to another dbname, script the procs and functions.

    Don't forget to script the granted authorities !

    Script them using SSMS and implement on your original db.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • have u alterd or droped these objects and u dont have a backup file to script them out of it?

    ..>>..

    MobashA

  • I can make script for these sp and functions, when again run on the db these sp and function may exist with old version. i want to alter such sp and functions is it possible......

  • You can do this in two ways:

    1. When you generate script for SPs/functions, set "script drop" to True. Now there will be a Drop statement for each object before each Create statement.

    2. Another simple way is to open the script in a text editor or SSMS and replace each Create keyword with Alter before each SP/function name.

  • thanks musarwar

    how i can set "script drop" to True., if u dont mind pls explain, i cannot find such an option when i create script

  • in sql 2000 and 2005 when u use th GUI to script objects like this :

    right click the database name then choose script .... what ever, then u choose the objects u want to script out and one of the options is to choose "true" for script drop/create statments.

    ..>>..

    MobashA

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply