Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3974784
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:36:31+00:00 2026-05-20T04:36:31+00:00

We want to record all db query into log table, is it possible?

  • 0

We want to record all db query into log table, is it possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:36:31+00:00Added an answer on May 20, 2026 at 4:36 am

    From a SQL Server perspective……

    As others have suggested, SQL Server Profiler is certainly one way to go but you’re going to incur a resource hit from doing so. Should you choose this method you absolutely must implement it as a Server Side Trace rather than via the GUI.

    You may also have some success monitoring, recording the contents of the Dynamic Management Views (DMV) for things such as query execution statistics.

    You’ll want to look at DMV’s such as:

    • sys.dm_exec_query_stats
    • sys.dm_exec_sql_text
    • sys.dm_exec_query_plan

    For example, here is a query that can be used to identify the poorest performing top 20 SQL queries by CPU consumption. Not exactly what you are after but it does demonstrate how to use the DMV’s that you would be interested in.

    SELECT TOP 20
        qs.sql_handle,
        qs.execution_count,
        qs.total_worker_time AS Total_CPU,
        total_CPU_inSeconds = --Converted from microseconds
            qs.total_worker_time/1000000,
        average_CPU_inSeconds = --Converted from microseconds
            (qs.total_worker_time/1000000) / qs.execution_count,
        qs.total_elapsed_time,
        total_elapsed_time_inSeconds = --Converted from microseconds
            qs.total_elapsed_time/1000000,
       st.text,
       qp.query_plan
    FROM
        sys.dm_exec_query_stats AS qs
        CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
        CROSS apply sys.dm_exec_query_plan (qs.plan_handle) AS qp
    ORDER BY qs.total_worker_time DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want make query select all names from table 'a' where from table 'b'
I want to copy a record with all his relations. I'm trying with: $o
I want to retrieve all records from one table when there are no matches
I want to get all the records from the one table which contain at
i have a table and it display all the record in the table using
Suppose you want to find the last record entered into the database (highest ID)
I want to create a new record in the mailers table, where three fields
I have run into a 1-N situation. i.e 1 record in 1st table will
I want to insert a row of data into a table with five columns
I want to write a page that will show all the records from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.