How to use xp_get_script from t-sql

  • Hi,

    I am trying to generate create object script from t-sql and came across this undocumented “xp_get_script” procedure, can anybody please tell me how to get the script for a given object by using this procedure?

    Thanks,

    ------------
    Prakash Sawant

    http://psawant.blogspot.com

  • Try this. Its working good for me. Create this proc in you current database.

    CREATE PROCEDURE sp_get_script @name sysname

    AS

    BEGIN

    exec master.dbo.xp_get_script @name

    END

    SQL DBA.

  • I have tryed that, but not able to get any script out.

    just getting below error.

    Msg 22047, Level 16, State 0, Line 0

    Error executing xp_get_script extended stored procedure: Specified resource name could not be found

    ------------
    Prakash Sawant

    http://psawant.blogspot.com

Viewing 3 posts - 1 through 2 (of 2 total)

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