Results 1 to 3 of 3

Thread: fn_get_sql

  1. #1
    Join Date
    Sep 2002
    Posts
    218

    fn_get_sql

    DECLARE @Handle binary(20)
    SELECT @handle=sql_handle
    FROM master..sysprocesses
    WHERE spid= 60

    SELECT * FROM ::fn_get_sql(@handle)

    When l use fn_get_sql l only get a aprt of the script that is being run. How can l get the whole script or prcedure to be displayed ?

    Second Question :

    Is there a way to track dropped objects, commands like delete,truncate at database level in sql and log these events into a table ?

  2. #2
    Join Date
    Feb 2003
    Posts
    1,048
    The data is being returned in a text field. By default, you will only see the portion of the text that fits within the size limits configured by using "Set TextSize".

    Execute "SELECT @@TEXTSIZE" to see how much is configured to be returned. The default size is 4K and can be set to a maximum of 2 GB.

    For more info on fn_get_sql: http://www.databasejournal.com/featu...le.php/2189761


    Your can either run profiler to look for these specific commands or you can use a log reader to read the tran logs.

  3. #3
    Join Date
    Sep 2002
    Posts
    5,938
    There are third party sql auditing tools.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •