Logging all SQL executed in time period - sql-server

In MS SQL Server 2008, I would like to investigate and tune the queries that are being executed by an application in a limited time interval. Can I, e.g. from SQL Server Management Studio, generate a log of all SQL being executed and how long time each query took (and which parameters they were executed with)?

You can use Profiler for this purpose - from SSMS, go to Tools -> SQL Server Profiler.

You need to use the MS SQL Profiler to do this
http://msdn.microsoft.com/en-us/library/ms181091.aspx

Related

SQL Server Activity monitor & explain plan truncates the query

SQL Server Management Studio 17.2
SQL Server 2014 (v12.0.6329.1)
I'm trying to track down a problematic query. I'm looking at the Activity monitor and when I try to view the whole query, it's truncated.
How do I configure SSMS to show the whole query?

Sql server cache settings

I have 2 databases. One is an old one created on Microsoft SQL server 2012 but restored to Microsoft sql server 2014
And another one that was created from scratch on Microsoft SQL server 2016 (was migrated).
I ran on both servers (below)
dbcc dropcleanbuffers;
DBCC FREEPROCCACHE;
When i run my app on first run it takes 30 mins for each database(a lot of data loading).
Once completed i close my app (making sure there are no active tasks)
I run again this time without clearing the cache.
SQL 2012 database now takes 4 mins however my SQL2016 database still take 30 mins.
if i run (below) again they both take the same time. (30 mins)
dbcc dropcleanbuffers;
DBCC FREEPROCCACHE;
I'm assuming this is a cache issue, so what i would like to know is, where are cache settings on the database / server and how to change them which will allow the sql 2016 database to perform the same as SQL 2012 database?
i am using winforms DBCommand and using ExecuteNonQuery() for query execution, I'm using SSMS to connect to sql server to view the database.
Thank you

Where is the SQL Query Analyzer in SQL Server Management Studio 2012

I have some SQL thats getting run and it is taking to long to return the results / parse / display, etc. application.
I have SQL Server Management Studio 2012 installed.but i am not able to find SQL Query Analyser.
Any Input will be appreciable.
Take a look at this link http://consultingblogs.emc.com/jamiethomson/archive/2008/07/10/query-analyzer-or-management-studio.aspx
The Query Analyzer (QA) was the query tool provided with SQL Server up until SQL Server 2000. In SQL Server 2005 and above it was superseded by SQL Server Management Studio (SSMS). If you would like to detect any performance problems in some of your queries you can use the execution plan to determine what is the culprit.
How to analyze a query : http://technet.microsoft.com/en-us/library/ms191227(v=sql.105).aspx
Briefing of how to analyze an execution plan : https://www.simple-talk.com/sql/performance/execution-plan-basics/
Are 2 links which definately can get you going. Also take a look at this introduction to SSMS 2012 which also can be useful https://www.youtube.com/watch?v=YipAwZ3Riok
starting from SQL Server 2005, SQL Server Management Studio is the new management tool (Enterprise manager replaced). Thus, the "New Query" tab is the place where you can write down and analyze your queries. You can see the Execution Plan, client data and so on.
SQL Query Analyzer does not exist anymore.

SQL Server 2008 table-valued function speed

We have a SQL Server 2008 function that returns a temp table
The function executes very fast in Management Studio but it is slow in application
If we run this function in the Management Studio once.
Then the application will speed up for some time
Do you know what could be the problem?

Query taking long time to insert data in sql server express

I have strange scenario in which if I create database using SQL Server 2008 Express (database compatibility level SQL Server 2008) and perform insert using xml datatype, it executes indefinitely, but when same query is executed on database with compatibility level SQL Server 2005 it runs fine and executes in less than one minute.
Thanks
Microsoft has whitepapers about changes between SQL2005 and 2008. I would look there for any related breaking changes. If you expect to get an adequate answer on this site I would suggest posting code.

Resources