SQL Text

  • Greetings one and all,

    I need to find all the current sql statments that are running with out having to use profiler. What tables do I need to interrigate to find this please.

     

    Much appreciated.

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • The following might bive you what you are after

    Declare mycursor Cursor for Select 'Print ' + convert (varchar, spid) + '

    dbcc inputbuffer ( ' + convert (varchar , spid ) + ')'

    From sysprocesses

    Where spid >13

    Declare @sql Varchar (1000)

    Open mycursor

    Fetch Next From mycursor into @sql

    While @@Fetch_Status = 0

    Begin

    Exec (@SQL)

    Fetch Next From mycursor into @sql

    End

    Deallocate mycursor

  • That is  very much along the lines of what I need, however to trow a spanner in the works, I am in a tight bind..

    I am the DBA for company A lets say, and we outsource for what ever reason only the powers that be know, company B to look after the database. Part of what I have to do is the application support so I need to be able to run profiler. However Company B will not give me sysadmin role to do so, nor am I able to runn ANY DBCC commands. So what I need to be able to do, is like in oracle query a table directly to gather the information regarding what sql text is running......

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • So basically your management are asking you to run a marathon but have chopped off your legs?

  • For the lack of a better solution.  Have that company run the traces for you and send you the output files.  Worst case is, it's your code that is running.  Get with your developers and analyze the statements in their code.

    Not the best easiest things to do, but I suppose you have to make things work.

    Tom

  • That is the solution that has been thrown around, have the 3rd part Co run Profilier and send me the output. I was hoping to be able to look at tables and get the info myself, but not much you can do with out legs....''Thanks for your input

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • run "limited" server side traces... they have minimal impact on the system

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

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