.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Why does this query timeout in an application but not in Management Studio?

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
I have a query that looks something like this:   SELECT TOP 1 * FROM Customers c (NOLOCK) WHERE Key = (mykey) AND NOT EXISTS (SELECT 0 FROM Invoices i (NOLOCK) WHERE i.key = c.key AND i.Date > GETDATE() )   When I run this inside an (ODBC) application, it times out.   When I run it within SSMS, it works fine.  That might make you think its an application problem, but the timeout only occurs for one specific customer ... even in the application, it works fine for all other key values.    Any idea where I can even start looking for a solution to this?  Thanks.

View Complete Post

More Related Resource Links

SQL server management studio 2008 freezes when running a query to Grid result

Hello, I've got problems when I run a Query to a grid result using SQL server management studio 2008 under W7 pro. When I execute the query, the first part of the grid returns, but then it freezes. The query should present a double resultset and contains approx 6100 records, devided over 2 grids. Strange enough, the query runs fine when I export to TXT or to a file. It seems though that the problem is building the grid. When it occurs I cannot end the application bij shutting down de SSMS window, but have to kill the Ssms.exe. In task manager I see only 25% CPU usage and approx 20% memory usage. Nothing exiting there I guess. Suggestions anybody? Microsoft SQL Server Management Studio      10.0.2531.0 Microsoft Analysis Services Client Tools      10.0.3798.0 Microsoft Data Access Components (MDAC)      6.1.7600.16385 Microsoft MSXML      3.0 4.0 5.0 6.0 Microsoft Internet Explorer      8.0.7600.16385 Microsoft .NET Framework      2.0.50727.4952 Operating System      6.0.6001 regards, Pim

SQL Query runs much slower with sql command than in management studio

I have two UPDATE queries, when executed together in SQL Command, takes about 5 minuts. but when executing together in management studio,totally takes about only 1 minute. I have indexes on all the fields used in join. Have done some research and tries some suggested ways such as use various SET options. not quite useful. Update   n Set FITokenCount = b.TokenCount , FISignificantOPTotal = b.SignificantOPTotal , FIInsignificantOPTotal = b.InsignificantOPTotal From   @ScanDataScanResultsTableName n   INNER HASH JOIN @ScanDataTableName b   ON n.InstitutionNumber = b.InstitutionNumber and n.DataItemUniqueID = b.DataItemUniqueID ;   Update   n Set WLTokenCount = wn.TokenCount , WLSignificantOPTotal = wn.SignificantOPTotal , WLInsignificantOPTotal = wn.InsignificantOPTotal From   @ScanDataScanResultsTableName n   INNER HASH JOIN WatchListEntryNames wn   ON n.WatchListEntryNameID = wn.WatchListEntryNameID --and wn.Type = 1;   Any inputs will be greatly appreiated.   Thanks,   Kevin        

Where is 'Change query type' (Enterprise manager) equivalent in the Management Studio


In sql server 2000 Enterprise manager, there was a ‘Change Query type’ icon and on clicking it, it gave you the option of changing the current query to a

Insert into
Insert From
Create Table

I can’t seem to find this in SQL Server Management Studio, does it exist somewhere or is there an equivalent way of doing it. Any help would be appreciated.




SQL 2005 Management Studio Timeout expired

I get the message - "Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding" - when working with large tables in Management Studio.

I have tried changeing the following:

1) Selected Tools -> Options

2) Expanded the "Query Execution" node

3) Clicked on "SQL Server"

4) Set value for "Execution time-out"  to 0 and  various  numbers up to 1800

Also checked the following

1) In Object Explorer I right-clicked on the server and selected "Properties"

2) Selected the "Advanced" page

4) Set the value for "Query Wait" under "Parallelism"  to various values from the default of -1 up to 1800.

SQL Server 2008 query execution time is different if i execute it in management studio or from code

When I execute query from software which i wrote in c# it required lots of time to complete but if I execute exactly the same query from management studio it will be done in seconds. In both cases execution plan is the same. 

Can we Implement in SQL MDX query SQL Signature as in normal SSMS(SQL Server Management Studio)


Can we implement SQL query signature in SQL MDX query? how can we implement the same

Error while setting up application on Win7 using Visual Studio.NET 2003


Hi All,

Getting the below error while setting up application on Win 7 using visual studio.NET 2003.


cannot find the components for communiacting with the front page server extensions...


I understand by the error, i need to install Front page server extension, but not able to figure how to install using IIS 7.5.

I had XP machine with IIS 5.1, able to find the option.


Need your help in resolving this.




Performance: Find Application Bottlenecks with Visual Studio Profiler


We will introduce you to the Visual Studio Profiler by walking through a sample performance investigation, pinpointing code inefficiencies in some sample applications.

Hari Pulapaka and Boris Vidolov

MSDN Magazine March 2008

VISUAL BASIC: Unleash The Power Of Query In Visual Studio "Orcas"


LINQ, coming in the next version Visual Studio, codename "Orcas", adds type-safe data querying to .NET languages.

Ting Liang and Kit George

MSDN Magazine June 2007

Crystal Reports: Add Professional Quality Reports to Your Application with Visual Studio .NET


Crystal Reports for Visual Studio .NET provides a comprehensive reporting solution for .NET developers that is thoroughly integrated with both the Visual Studio .NET IDE and the .NET Framework. Crystal Reports supports ADO.NET, XML Web Services, and ASP.NET server controls and caching. It also integrates seamlessly with the Visual Studio .NET Server Explorer, toolbox, and design environment. It has a rich programming model and flexible options for customizing and deploying reports. These major features and others covered here take the drudge work out of data representation in your own applications.

Andrew Brust

MSDN Magazine May 2002

Tip #107 Did you know . How to improve debugging performance for MVC2 application in Visual Studio 2

VS2010 Ultimate included IntelliTrace functionality by default.  IntelliTrace captures events (e.g. exceptions), and can affect performance of debugging. The typical performance hit is about 5% in the default mode (collection can be increased to...(read more)

Create table in the database using management studio


 I have database already on the server. However, when I created new table, the new created table Schema is not dbo. it is my user name. How to solve this?

It shows the new created table Schema is my username but not dbo.

Even though I rename it, it couldn't change. I can see this in table property.



SharePoint 2010: Application Lifecycle Management (ALM) Resource Center

Are you looking for information about BCS? BCS enables users to read and write data from external systems-through web services, databases, and .NET assemblies.

SQL Server Management Studio


Hi folks


Am sorry if this mght be abit silly question am a Novice Developer.

If am using Visual Studio 2008 Pro, Do I need SQL Server Management Studio? or is it included in the VS 2008 Pro Suite? Am learning C# and SQL Server.



How to connect to local instance of SQL Server 2008 Management Studio Express ?


I just installed SQL Server 2008 Management studio Express on my Vista machine.

i tried connecting to local machine using :

.\sqlexpress, (local)\sqlexpress, or .\SQLExpress, MyPCNAME\SQLExpress

nothing is working, getting this error:

Cannot connect to PC-NAME\SQLEXPRESS. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Tables not showing in Management Studio Express


Hi all

(needing help!)

Have used Visual Web Developer 2008 to make ASP application, with SQL server 2008 R2 Express for database. Works very nicely.

However, when I come to use Management Studio Express 2008 R2, I cannot see all my tables.

The ones I CAN see were created by the MS script that creates membership tables (and are called dbo.aspnet_membership etc), presumably because the owner of the tables was specified as 'dbo'.

The ones I can't see from Management Studio are the ones I created. I never specified an owner.

I think this is a permissions issue, but I can't fathom it. There's only ever been me on my development machine (laptop) doing it all, hence always the same log ins.

Running Management Studio as Adminstrator doesn't help.

I can't even ask Management Studio who own's the tables that I can't see because Management Studio can't see them so rejects the script.

Any ideas/links very (very) welcome !


**** Actually, it is even wierder. The tables in Management Studio have full structure, but are empty. But if I look at them in Visual Basic 2008 they are full !!!  And...if I create a table in Management Studio it does not appear at all in Visual Basic, and likewise, a table created in Visual Basic does not appear at all in Management

how to add a row without a sql management studio

Hi, If I want to provide a way to INSERT rows to a table without having to use SMS, what is the way to go? Is there such a thing as a sql script? so that you can just change the data in the file and double click to write it to db? Thanks.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend