SQL Server 2008 table-valued function speed - sql-server

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?

Related

How to migrate from sql server 2008 to 2012?

I am facing an issue of migrating from 2008 sql server to 2012 sql server.
I am seeing two methods of migration in-house and parallel ones which one is better and how to do?
It is better to migrate to PostgreSQL.:) otherwise, i guess always better to make pure sql dump (in sql server management studio chose command in context menu Generate scripts, where choose structure and data) and simply execute it on new database

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.

Logging all SQL executed in time period

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

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.

SQL Server Management Studio Clear Cache Code Completion

If you change a table, then code completion doesn't work anymore when writing a query in SQL Server Management Studio. Is there a way to clear this cache?
(SQL Server 2008)
You can try
Edit -> Intellisense -> Refresh Local
Cache (CTRL+Shift+R)
From SQL Server 2008 Intellisense update/refresh on schema changes

Resources