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

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

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

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :Sql Server
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        

View Complete Post

More Related Resource Links

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

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.

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

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 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

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

Command Management: Use Design Patterns to Simplify the Relationship Between Menus and Form Elements


In Windows Forms applications, similar commands, such as those in a menu and their counterparts on a toolbar, are not automatically related. They don't fire the same event or run the same handler routine. Yet code that allows the same or similar user commands to fire the same code simplifies development.This article describes the principles of command management and why it's important to have functional commands that are not exclusive to any one UI element. In order to provide an MFC-like command management infrastructure, a design pattern is developed and applied as a series of C# classes.

Michael Foster and Gilberto Araya

MSDN Magazine October 2002

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.



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

Query Command to Report


I would like to generate a crystal report showing the report data based on my custom SQL query.

Where I can provide my SQL query or stored procedure.

Please give me good tutorial links on this too.

Thanks in advance.

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.

SQL Server Management Studio Slow Grid Draw and Refresh

I've istalled SQL2005/SSMS on my development machine and connecting to a local SQL Server 2005. Executing queries is fast but the results grid populating is slow and so is the refresh of the same data. This is not a slow query, its the gridview draw/redraw. I've other PC's with slower processors and less ram with the same software run circles around the SMSS Performance on this Laptop   I've read posts about nvidia graphics drivers and mouse drivers causing issues similar to this. I do have an nvidia quadro x1600M (this is a laptop Compaq 8710w) and switching off the accelerator using Displays/Advanced/Troubleshooting by moving the slider to the middle/center position causes the gird refresh to dramatically increase. It's funny how turning oof the accelerator increases performance.   I have the latest HP nvidia drivers and SSMS is useable without hardware acceleration  but I also develop software that uses directx and its getting really troublesome to work this way.   I am running:   Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 2 (2600.xpsp_sp2_qfe.070227-2300)Language: English (Regional Setting: English)System Manufacturer: Hewlett-PackardSystem Model: HP Compaq 8710wBIOS: EPP runtime BIOS - Version 1.1 Processor: Intel(R) Core(TM)2 Duo CPU     T7300  @ 2.00GHz (2 CPUs)Memory: 3072MB RAMPage File: 515MB used, 4439MB availableWindows Dir: C:\WIN

Copy/Paste Fails in Management Studio

After opening Management Studio and doing some editing it is possible to copy/paste things in the query editor. After a while (working in another app) I come back to Management Studio and I can't copy/paste anything anymore. If I try to copy from the results window I get an error message that the clipboard operation did not succeed. If I try to copy from the query editor window it just doesn't copy. I can copy/paste in other apps without a problem.   I have seen this problem described in other forums so I'm not alone but I have 3 other computers where this problem does not occur. The one machine with the problem is hyper-threading. I wonder .... Any other ideas? It is not the clipboard getting full but I can't rule out much else.

MSSQL Management Studio + Windows 7 pro = Problem ?

Hello, My DBA was using Windows XP + MSSQL Management studio 2005 (no SP applied). Everything was fine. Now we upgraded his machine to Windows 7 Pro and MSSQL Management stuio is crazy. We are unable to open 6000 row tables. The program freez and burn 2gigs of memory.   Do I miss something ? SP3 is applied and its still doing nasty things.   MSSQL Stuio Management version : 9.00.4035.00   Thanks !

Please Help Installing SQL Management Studio (not Express) w/ local SQL Server Express

I have recently formatted my hard drive and over the past few days I've been reloading my software.  I have installed on my machine SQL Server Express 2005 SP3.  I prefer to have SQL Express running on my development machine because that is what my customers primarily use.  I also have a full MSDN license, and I would need to install SQL Management Studio 2005.  However, when I download the SQL Server 2005 Developer ISO from MSDN, and run the setup file I get an error message that states: Installation of Microsoft SQL Server Native Client failed because a higher version already exists on the machine.  To proceed, uninstall the higher version and then run Microsoft SQL Server Native Client Setup. I would assume the problem is that the copy of SQL Server - Dev Edition that is available through my MSDN subscription is using an earlier version of SQL Server 2005 (most likely the version prior to SP1.)  I would just unistall SQL Server Express 2005 SP3 and reinstall it with out any service pack updates.  The problem is that I also see within my Add or Remove Programs list  four SQL Server 2008 R2 entries, that I believe were installed when I installed Visual Studio Pro 2010 (they are, Microsoft SQL Server 2008 R2 Data-Tier Application Framework, Microsoft SQL Server 2008 R2 Data-Tier Application Project, Microsoft SQL Server 20
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