Strange SQL Performance Problem

Apr 21, 2008

Dear All,

I got a strange performance issue with my existing application. The application run fine for a period of time. However, it got timeout error every time now when the number of records have been grown to a certain size.

The program uses Typed DataSet to access SQL Server 2005 database. The connection is made over a VPN. The same program and SQL run in a LAN environment performs not too bad. However, when it is run over the VPN, the CPU and I/O usage jumped to very high numbers. In the SQL Profiler, I found that the duration of execution is less than 20ms in LAN environment while the VPN will give me a figure around 30000ms (This means timeout).

I don't want to simply increase the timeout of my connection and command in order to solve this problem temporary. What's the actual cause of such huge difference in the performance?

Please give me some hints! Thanks a lot!

Regards,
Alex

View 9 Replies


ADVERTISEMENT

Strange Performance

Jul 20, 2005

I have a strange performance question hopefully someone can clarifyfor me. I take a production database and make a copy of it, calledtest, on the same instance on the same server both running at the sametime. All the same things are running for each database and no one isusing each database but me. From Query Analyzer I run a SQL againstproduction three times in a row and it takes 1 minute 40 seconds onthe last/best run. I then run the same SQL against the test copy andrun it three times in a row and the last/best time is 12 seconds. Cananyone explain this behavior? If so, I hope this points to something Ican do to my production database to get the same performance.Thanks,MGB

View 5 Replies View Related

Strange Performance Issue

May 12, 2006

Hi,
I have a strange performance issue. I have the following query which takes 40+ seconds to run.  SELECT Count(x)
FROM view WHERE x = 347
AND y = 10056
AND z = 2
AND w = '01'
But if i switch it to below, the query returns the one result quickly (1 second).SELECT x
FROM view WHERE x = 347
AND y = 10056
AND z = 2
AND w = '01'
If the view is returning results quickly, why is it so much trouble for SQL to run the aggregate function on the results?Any help is appreciated. -Brian

View 3 Replies View Related

Strange Performance Question

Nov 28, 2005

Hi,I have a really interesting one for you guys...SQL Server 2000 sp3 on Windows Server 2003If I run this query:declare@find varchar(50)SET @find = 'TTLD0006423203'SELECT TOP 250ConsignmentID,c.CreatedFROM tblConsignment c WITH (NOLOCK)WHERE c.ConNoteNum LIKE @find + '%'ORDER BY c.Created DESCIt takes 5 - 7 seconds with an Index Scan on the Consignment TableHOWEVER, if I run either of the next two queries below they are instant(under 1 second) with no scan only an Index Seek ..declare@find2 varchar(50),@SQL nvarchar(4000)SET @find2 = 'TTLD0006423203'SET @SQL = 'SELECT TOP 250ConsignmentID,c.CreatedFROM Tranzbranch_archive.dbo.tblConsignment c WITH (NOLOCK)LEFT JOIN tblCustomer cu WITH (NOLOCK) ON c.FreightPayerCode =cu.CustCodeWHERE c.ConNoteNum LIKE ''' + @find2 + '%''ORDER BY c.Created DESC'execute sp_executesql @stmt = @SQLORSELECT TOP 250ConsignmentID,c.CreatedFROM tranzbranch_archive.dbo.tblConsignment c WITH (NOLOCK)LEFT JOIN tblCustomer cu WITH (NOLOCK) ON c.FreightPayerCode =cu.CustCodeWHERE c.ConNoteNum LIKE 'ttld0006423203%'ORDER BY c.Created DESCCan you please help me as this is causing Huge issues in our Live systemand I really don't want to rewrite 400+ stored procedures!!!!Thank you thank you thank you in advance....:-)Auday*** Sent via Developersdex http://www.developersdex.com ***

View 2 Replies View Related

Strange Performance Issue

Apr 12, 2007

Hi,



I've got a strange performance issue:



I'm using a SQL statement with a CTE to recursively get all node-ids from a tree beginning with a root node. In a select statement I'm using this CTE to get in a SELECT ... WHERE nodeID IN (SELECT ID FROM CTE_Nodes) statement data that is according to the nodes related to the root-node.



In our ASP.NET 2.0 application these statements are very slow or time out with an Exception. When I'm executing the same statement in a Management Studio the statement executes in less than one second.



BTW, we're using SQL Server 2005 Standard Ed. (9.0.3050 + 9.0.3054) in SQL Server 2000 compatibility mode with SQL Authentication.



I'm a bit frustrated, because the statements are the same.



Thanks in advance,

Klaus



Update:

BTW, the SQL Server is on a server machine and the Management Studio and the ASP.NET application on my developer machine. For data access we're using Enterprise Library 2.0 with System.Data.SqlClient.

Which possibilities do we have to trace this issue? Please help.

View 9 Replies View Related

Strange SQL Server/ASP.NET Performance Problem

Jun 14, 2006

Hi,
I have a SQL Server stored procedure that gets called in the ASP.NET application. For a while it will return results quickly. After an unknown amount of time the stored procedure starts taking forever to execute. If I go into Query Analyzer and execute the same stored procedure using the exact same input parameters the results return quickly. If I then go back into the application and run the code that executes the stored procedure, the results return quickly again.
So basically every time the application call to the stored procedure begins to slow, I run that stored procedure in query analyzer and then it runs fine in the application again.
Has anyone else experienced anything like this or have any ideas as to why this would happen?
 
-Brian

View 1 Replies View Related

Strange Query Performance Issue

Nov 23, 2006

Jezemine,
No, the number of reads is approximately the same. I can also confirm the disk read speed is the same on the test vs. production server. Update stats is run regularly on the production server - as I test, I ran sp_updatestats and then immediately ran the query a few times but it didn't affect the duration. Apart from the durations in the profiler traces, I can't see any differences. Clearly, something is causing the increased duration on the prod server but I don't know where to look to find it. It's definitely within SQL Server 2000.

Clive

View 8 Replies View Related

Strange Performance Issue With UPDATE FROM

Jun 26, 2007

Hello!I have this piece of SQL code:UPDATE aSET Field1 = c.Field1FROM aINNER JOIN b ON a.GUID1 = b.GUID1INNER JOIN c ON b.GUID2 = c.GUID2WHERE c.Type = 1AND @date BETWEEN b.DateFrom AND b.DateToThis query takes hours to complete.Now while trying to find out what's causing the poor performance (itsurely looks simple enough!) I've rewritten it to use temp tables:SELECT a.GUID1, a.Field1, c.Type, b.DateFrom, b.DateTo INTO #temptableFROM aINNER JOIN b ON a.GUID1 = b.GUID1INNER JOIN c ON b.GUID2 = c.GUID2WHERE c.Type = 1AND @date BETWEEN b.DateFrom AND b.DateToUPDATE a SET Field1 = subsel.Field1FROM (SELECT * FROM #temptable) AS subselWHERE subsel.GUID1 = a.GUID1Now it completes in 10 seconds.My question is why? Am I wrong in saying that the two batches aboveproduce same results? Is there something I've missed about the UPDATEFROM syntax? Why would the first query perform THAT poorly?Table sizes:a: 24k rowsb: 268k rowsc: 260k rowsGUIDs are of type uniqueidentifier.Any answers appreciated!Regards,// Richard

View 8 Replies View Related

Strange Update Performance Using ODBC

Apr 23, 2008

Hi All,


Not sure if this question belongs in this area or the server area but I'll start here. Here is my problem. We have an C/C++ app that was originally written for SQL 2000 and uses DBLibrary. We have converted it to SQL 2005 and are using ODBC/Native client to access the SQL 2005 database. This all works great. So we were doing some performance testing and we noticed that our update performance seems slower in the SQL 2005/ODBC case than it did in the SQL 2000/DBLibrary case. Inserts and queries all perform great, in fact the inserts are significantly faster in the SQL 2005/ODBC case which is good. We are using Array inserts/updates/queries wherever possible as this is faster obviously. In our update case, it takes 1.14 seconds to update 2000 rows in table in the SQL 2005/ODBC case, while SQL 2000/DBLibrary case takes .39 seconds to the exact same thing. The table in question is a 12 column table with all integer columns, with an index on the first three columns.


So my question is this. Is there something different about Array Updates in SQL 2005 ? I've looked thru the list of hot fixes available since SQL 2005 SP2 and haven't seen anything that directly mentions Updates so I'm hesitant to go off and start applying the hot fixes to our server to see if the behavior changes. It seems strange to me that Array Inserts would be very fast, but Updates wouldn't be. I've checked the ODBC Data Source and we aren't doing anything fancy there. I'm not actually even sure if this problem is client side or server side as I said earlier.


If anyone has any ideas or thoughts that would be great since this is really bugging me.

Here is a sample of what our C code is doing. This is simplied and I've removed a lot of our own code but these are the SQL calls that we are making in order so maybe can see something wrong I'm doing.

//----Sample Code -------------------------------------------------------------------------------------
pSQL = "Update bob set VV=? where VI=?" // not done this way actually in our code but just to show the update text

status = SQLPrepare ( hS, (UCHAR *)pSQL, SQL_NTS );

// Called twice with nCol = 1 and then with nCol = 2
status = SQLSetParam (
hS,
abs(nCol),
cType, // cType = 5 = SQL_C_LONG
sqlType, // sqlType = 4 = SQL_INTEGER
38, // size needed in case the column is numeric or decimal
0,
p16Data, // Pointer to my array of data
NULL
);

SQLSetStmtAttr(hS, SQL_ATTR_PARAMSET_SIZE, (SQLPOINTER)numrows, 0); // numrows = 2000

SQLSetStmtAttr(hS, SQL_ATTR_PARAMS_PROCESSED_PTR, &p16cRows, 0);

status = SQLExecute (hS);

SQLParamOptions(hS, 1, NULL);
SQLFreeStmt ( hS, SQL_RESET_PARAMS );

//----Sample Code -------------------------------------------------------------------------------------

Thanks,
Nick

View 5 Replies View Related

Service Broker Strange Performance Spikes

Feb 7, 2008

I have a simple stored procedure that send a message on a conversation:



Code Snippet

CREATE PROCEDURE [Vxml].[sp_SendMessageToWarehouse]
-- Add the parameters for the stored procedure here
@Message XML,
@EntityId uniqueidentifier,
@ConversationHandle uniqueidentifier OUTPUT
AS
BEGIN
BEGIN TRY
;SEND ON CONVERSATION @ConversationHandle MESSAGE TYPE VxmlEngineXMLMessage(@Message);
END TRY
BEGIN CATCH
INSERT INTO [Vxml].SBError (ErrorMsg) VALUES (N'Error <' + ERROR_MESSAGE() + N'> for entity <' + cast(@EntityId as NVARCHAR(max)) + N'> on conversation <)' + cast(@ConversationHandle as NVARCHAR(max)) + N'> with body ' + cast(@Message as NVARCHAR(max)))
END CATCH;
END






This completes in less than 100ms (avg 30ms) except once in about 10000 executes (only one simultaneous execute), then this takes about 3 seconds to complete.

When performing the same test and calling the stored procedure simultaneously from 5 to 20 threads, we see up to 3 such spikes (in 10000 executes) taking 2 to 4 seconds.




Conversations are created before the test and closed after. No ODBC errors occur and the SBError table is empty.This is run on an SQLEXPRESS the conversation target is a SQL Server 2005 (standard edition)

Can anyone explain these strange performance spikes ?

View 1 Replies View Related

HELP: Strange Blocking Performance Problem With Simultaneous Queries

Dec 1, 2005

Hello everyone, I am hoping someone can help me with this problem. Iwill say up front that I am not a SQL Server DBA, I am a developer. Ihave an application that sends about 25 simultaneous queries to a SQLServer 2000 Standard Edition SP4 running on Windows 2000 Server with2.5 GB of memory. About 11 of these queries are over views (all overthe same table) and these queries are all done from JDBC but I am notsure that matters. Anyway, initially I had no problem with thesequeries on the tables and the views with about 4 years of information(I don't know how many rows off hand). Then we changed the tables toreplicated tables from another server and that increased the amount ofdata to 15 years worth and also required a simple inner join on 2columns to another table for those views.Now here is the issue. After times of inactivity or other times duringthe day with enough time between my test query run I get what lookslike blocking behavior on the queries to the views (remember these allgo to the same tables). I run my 25 queries and the 11 view queriesall take about 120 seconds each to return (they all are withinmilliseconds of each other like they all sat there and then werereleased for processing at the same time). The rest of the queries arefine. Now if I turn around and immediately run the 25 queries again,they all come back in a few seconds which is the normal amount of time.Also, if I run a query on one of views first (just one) and then runthe 25 queries they all come back in a few seconds as well.This tells me that some caching must be involved since the times are sodifferent between identical queries but I would expect that one of thequeries would cache and thus take longer but the other 10 would befast, not all block for 2 minutes. What is more puzzling is that thisbehavior didn't occur before where now the only differences are:1) 3 times more data (but that shouldn't cause a difference from 3seconds to 120 and all tables have been through the index wizard with aSQL trace file to recommend indexes)2) There is now a join between 2 tables where there wasn't before3) The tables are replicated throughout the day.I would appreciate any insight into this problem as 120 seconds is waytoo long to wait. Thanks in Advance.Chris

View 1 Replies View Related

Strange Performance Problem With SELECT COUNT(1) And Sp_executesql

Feb 22, 2008

Hello,

I have the following queries that run on a view called EntrySummary:

1)

exec sp_executesql N'SELECT COUNT (1) FROM [dbo].[EntrySummary] WHERE [EntrySummary].[SubmissionStatusID] = @SubmissionStatusID0 AND [EntrySummary].[CreatedBy] = @CreatedBy1',N'@SubmissionStatusID0 int,@CreatedBy1 nvarchar(20)',@SubmissionStatusID0=4,@CreatedBy1=N'domainaperson'


2)
exec sp_executesql N'SELECT COUNT (1) FROM [dbo].[EntrySummary] WHERE [EntrySummary].[CreatedBy] = @CreatedBy1 AND [EntrySummary].[SubmissionStatusID] = @SubmissionStatusID0',N'@SubmissionStatusID0 int,@CreatedBy1 nvarchar(20)',@SubmissionStatusID0=4,@CreatedBy1=N'domainaperson'


(The only difference between the two queries being the order of the where clauses)

Both return the correct answer (4144), but Query 2 takes 10-15 seconds whereas Query 1 takes < second.
If the same query is resubmitted several times, this doesn't affect the times.

(The vast majority of the records have a status of 4, but only about 3% will be created by the person).

Replacing Count(1) with count(*) makes both queries return quickly.

Is sp_executesql creating poor execution plans ? Can anyone explain this behaviour?


Regards,
AndyM

View 1 Replies View Related

Strange, Very Strange (BIDS)

Jul 19, 2006

Hi everyone,

I€™m suffering a queer behaviour when I use BIDS. Concretely, when I open a dtsx from my project (it has 10 packages) many times Sequence Container and Data Flow tasks are invisible. I mean, its lines are not visible at all whereas its titles are. I mean, what you see is just a white box€¦

Then, I€™m gonna Data Flow layer and I have to do double-clik over the tasks and are visible but on Control Flow I don€™t see how to solve.

Curiously in our development and production server such behaviour doesn€™t happen (we are accessing by mean Terminal Server from our workstations)

How odd!. Everything is fine except this.

I want to remark you that such project has been copied from the server, this is, these packages are been built on the server

Thanks for your thougts or ideas,

View 5 Replies View Related

[Performance Discussion] To Schedule A Time For Mssql Command, Which Way Would Be Faster And Get A Better Performance?

Sep 12, 2004

1. Use mssql server agent service to take the schedule
2. Use a .NET windows service with timers to call SqlClientConnection

above, which way would be faster and get a better performance?

View 2 Replies View Related

Extremely Poor Query Performance - Identical DBs Different Performance

Jun 23, 2006

Hello Everyone,I have a very complex performance issue with our production database.Here's the scenario. We have a production webserver server and adevelopment web server. Both are running SQL Server 2000.I encounted various performance issues with the production server with aparticular query. It would take approximately 22 seconds to return 100rows, thats about 0.22 seconds per row. Note: I ran the query in singleuser mode. So I tested the query on the Development server by taking abackup (.dmp) of the database and moving it onto the dev server. I ranthe same query and found that it ran in less than a second.I took a look at the query execution plan and I found that they we'rethe exact same in both cases.Then I took a look at the various index's, and again I found nodifferences in the table indices.If both databases are identical, I'm assumeing that the issue is relatedto some external hardware issue like: disk space, memory etc. Or couldit be OS software related issues, like service packs, SQL Serverconfiguations etc.Here's what I've done to rule out some obvious hardware issues on theprod server:1. Moved all extraneous files to a secondary harddrive to free up spaceon the primary harddrive. There is 55gb's of free space on the disk.2. Applied SQL Server SP4 service packs3. Defragmented the primary harddrive4. Applied all Windows Server 2003 updatesHere is the prod servers system specs:2x Intel Xeon 2.67GHZTotal Physical Memory 2GB, Available Physical Memory 815MBWindows Server 2003 SE /w SP1Here is the dev serers system specs:2x Intel Xeon 2.80GHz2GB DDR2-SDRAMWindows Server 2003 SE /w SP1I'm not sure what else to do, the query performance is an order ofmagnitude difference and I can't explain it. To me its is a hardware oroperating system related issue.Any Ideas would help me greatly!Thanks,Brian T*** Sent via Developersdex http://www.developersdex.com ***

View 2 Replies View Related

Very Poor Performance - Identical DBs But Different Performance

Jun 22, 2006

Hello Everyone,I have a very complex performance issue with our production database.Here's the scenario. We have a production webserver server and adevelopment web server. Both are running SQL Server 2000.I encounted various performance issues with the production server witha particular query. It would take approximately 22 seconds to return100 rows, thats about 0.22 seconds per row. Note: I ran the query insingle user mode. So I tested the query on the Development server bytaking a backup (.dmp) of the database and moving it onto the devserver. I ran the same query and found that it ran in less than asecond.I took a look at the query execution plan and I found that they we'rethe exact same in both cases.Then I took a look at the various index's, and again I found nodifferences in the table indices.If both databases are identical, I'm assumeing that the issue isrelated to some external hardware issue like: disk space, memory etc.Or could it be OS software related issues, like service packs, SQLServer configuations etc.Here's what I've done to rule out some obvious hardware issues on theprod server:1. Moved all extraneous files to a secondary harddrive to free up spaceon the primary harddrive. There is 55gb's of free space on the disk.2. Applied SQL Server SP4 service packs3. Defragmented the primary harddrive4. Applied all Windows Server 2003 updatesHere is the prod servers system specs:2x Intel Xeon 2.67GHZTotal Physical Memory 2GB, Available Physical Memory 815MBWindows Server 2003 SE /w SP1Here is the dev serers system specs:2x Intel Xeon 2.80GHz2GB DDR2-SDRAMWindows Server 2003 SE /w SP1I'm not sure what else to do, the query performance is an order ofmagnitude difference and I can't explain it. To me its is a hardware oroperating systemrelated issue.Any Ideas would help me greatly!Thanks,Brian T

View 2 Replies View Related

Now This Is A Strange One.

Mar 6, 2007

I have a datasource where i assign the control Parameter value depending on whether theres a value in the querystring or a gridview selectedvalue is indeed selected.When i do this using a querystring it works fine, however, when i do it using gridView_selectedIndexChanged it doesn't work.Here's the code     <asp:SqlDataSource ID="jobDetailsDS" runat="server" ConnectionString="<%$ ConnectionStrings:promanConn %>" SelectCommand="SELECT tblJobs.intJobId, tblJobs.intJobStaffId, tblJobs.intJobUserId, tblJobs.intJobCategoryId, tblJobs.strJobTitle, tblJobs.strJobDesc, tblJobs.strJobNotes, tblJobs.dateJobLogged, tblJobs.dateJobDeadline, tblJobs.dateJobCompleted, tblJobs.intJobPriorityId, tblJobs.strJobSolution, tblJobs.boolJobCompleted, tblPriority.priorityName, tblPriority.id, tblPriority.priorityOrder, tblStaff.staffName, tblStaff.id AS staffID, tblProblemCategoriesLookup.strProblemCatName, tblProblemCategoriesLookup.intProblemCatId, tblStaff_1.id AS Expr1, tblStaff_1.staffName AS UserName FROM tblJobs INNER JOIN tblPriority ON tblJobs.intJobPriorityId = tblPriority.id INNER JOIN tblStaff ON tblJobs.intJobStaffId = tblStaff.id INNER JOIN tblProblemCategoriesLookup ON tblJobs.intJobCategoryId = tblProblemCategoriesLookup.intProblemCatId INNER JOIN tblStaff AS tblStaff_1 ON tblJobs.intJobUserId = tblStaff_1.id WHERE (tblJobs.intJobId = @intJobId)"     InsertCommand="INSERT INTO tblJobs(intJobStaffId, intJobUserId, intJobCategoryId, strJobTitle, strJobDesc, strJobNotes, dateJobLogged, dateJobDeadline, intJobPriorityId, boolJobCompleted) VALUES (@intJobStaffId, 56 , 39, @strJobTitle, @strJobDesc, @strJobNotes,{ fn NOW() }, { fn NOW() }, @intJobPriorityId, 0); ">                <SelectParameters>            <asp:Parameter Name="intJobId" Type="int32" />        </SelectParameters>        <InsertParameters>            <asp:Parameter Name="intJobStaffId" Type="Int32" />            <asp:Parameter Name="strJobTitle" Type="String" />            <asp:Parameter Name="strJobDesc" Type="String" />            <asp:Parameter Name="strJobNotes" Type="String" />            <asp:Parameter Name="intJobPriorityId" Type="Int32" />            <asp:Parameter Name="intJobUserId" Type="Int32" />        </InsertParameters>    </asp:SqlDataSource>Code Behind             ElseIf dest > 0 Then            jobDetailsDS.SelectParameters.Item("intJobId").DefaultValue = Request.QueryString("dest")            notesDS.SelectParameters.Item("intJobId").DefaultValue = Request.QueryString("dest")            notesDS.InsertParameters.Item("intJobId").DefaultValue = Request.QueryString("dest")            gvActiveJobs.Visible = "False"        End If    End Sub    Protected Sub gvActiveJobs_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvActiveJobs.SelectedIndexChanged        gvActiveJobs.Visible = "False"        jobDetailsDS.SelectParameters.Item("intJobId").DefaultValue = gvActiveJobs.SelectedValue        notesDS.SelectParameters.Item("intJobId").DefaultValue = gvActiveJobs.SelectedValue        notesDS.InsertParameters.Item("intJobId").DefaultValue = gvActiveJobs.SelectedValue    End Sub I also debugged and checked the value of gvActiveJobs.SelectedValue and it is what i was expecting but its still no good.Can anyone help?ThanksMatt 

View 2 Replies View Related

Very Strange

Nov 19, 2001

I moved a table from one file group to another file group. After moving the table the row count show 0 but when I open the table it’s returning all the rows. Is something wrong with the table? Do I have created a cluster index and drop on the table?

View 1 Replies View Related

Strange Fix

Aug 2, 2006

Hi,
I have table in my db thats used as a temporary table. At the end of the day it contains thousands of records which get summarized then all are deleted. I recently moved the application over to a new server with pretty much the same hardware config and noticed a big performance hit when running queries on this temp table (455 milliseconds as opposed to 1) In short, the fix was dropping the table and re-creating it.
Anybody know how this could be? I know that even if you delete records from a table, the table still seems to retain its physical size on the hard drive, could this have something to do with it?

Thanks

View 3 Replies View Related

Strange!

May 4, 2004

CREATE TABLE #users(users varchar(50),pasw varchar(50),title varchar(50))
insert into #users select 'test','abcdef','ceo'
SELECT * FROM #users
alter table #users alter column pasw nvarchar(50)
update #users set pasw=pwdencrypt(pasw)
SELECT * FROM #users

What happens to the TITLE column?
I had a table like the above with users and passwords in the Production DB. The password column had VARCHAR type. I changed it to NVARCHAR and encrypted the passwords. When i executed the SELECT *, the title column appeared like this. :eek:
If i query the table by column names instead of * i see the correct values. I couldn't understand what behaviour is it.

Howdy!

View 7 Replies View Related

Strange

May 22, 2008

Hi Experts,
Am able to restart my local sql server using a login which dont have a sysadmin privileage.This login only have access to a particular database .Its only having datareader and datawriter as DB roles but still am able to restart the server.Please help


TIA


RKNAIR

View 5 Replies View Related

Strange Error

Aug 3, 2006

I am using c# and ASP.NET 2 and I am getting a very strange error. I
have a field called CompanyID in SQL Server 2005, and it allows null
values in it. When this CompanyID is not NULL, ie for example it is
202, then when i press the update button it allows me to update
perfectly in the database. However if the CompanyID is NULL,
and I try to update the companyID, to lets say 202, the application
just crashes with the following message:- System.InvalidCastException: Object cannot be cast from DBNull to other types. I tried to set some breakpoints in the application to debug, however it does not even pass through these breakpoints! Any ideas on what the problem can be or how I can debug? Thanks for your help and time Johann

View 6 Replies View Related

Strange Behaviour

Oct 3, 2006

This is the actual statement displayed from Response.Write in classic ASP. INSERT INTO WOTasks (WoNum,TaskNum,TaskDesc,TaskMemo,Account,ModifyDate,Estimate,TaskHours,Unit,UnitCost,TotalCost) SELECT '06-012497',TaskNum,TaskDesc,TaskMemo,Account,'2006-Oct-3',1,TaskHours,Unit,UnitCost,TotalCost FROM Tasks WHERE procnum = '000002' There are 4 records returned from the SELECT part of the statement. In some situations, 4 records are inserted to WOTasks table, in others, only 1 record is inserted. I can't find out why 1 record, instead of 4, record is inserted. A form page submits the form to the save page using post method. The above statement is contained in the save page. When one of the form textbox is filled, 1 record is inserted. When the textbox is not filled, 4 records are inserted. You may think the textbox has something to do with the behaviour. I also think so but the content of the textbox does not affect the sql statement. In both cases, the insert statement is the same. In the actual codes, only strings in quotes are variables and the rest are hardcoded. When I run the statement in SQL Server, 4 records are affected. No such problem when connected with Access.The actual code belowSub AddTask(ByVal proc, ByVal wonum)   Dim sSQL   sSQL = "INSERT INTO WOTasks (WoNum,TaskNum,TaskDesc,TaskMemo,Account,ModifyDate,Estimate,TaskHours,Unit,UnitCost,TotalCost) SELECT '" & wonum & _          "',TaskNum,TaskDesc,TaskMemo,Account,'" & curDate & "',1,TaskHours,Unit,UnitCost,TotalCost FROM Tasks WHERE procnum='" & proc & "'" 'Response.Write sSQL:Response.End   conn.Execute sSQL, , 128 End Sub

View 2 Replies View Related

Strange SQL Issue

Jan 20, 2008

Hi there I have this statement I have written as follows:strCommand = "SELECT * FROM tblstock WHERE Type='"&Statement &"' AND Description like'"&criteria &"%' OR Tag like'"&criteria &"%'OR Location like'"&criteria &"%' OR LAN like'"&criteria &"%' OR RAM like'"&criteria &"%' OR CD like'"&criteria &"%' OR OS like '" &criteria &"%' OR SN like'" &criteria &"%' OR DeviceStatus like'" &criteria &"%' ORDER BY " &sSortStr     The variable "Statement" is passed into the sub as "PC"  which means only records of type "PC" should be displayed along with any other criteria.  The issue I'm having is that when I specify criteria I'm also recieving other types eg "Cameras" if they contain any of my criteria..  I can't understand how because in the statement I tell it only to display records of type "PC".. Anybody know what I'm doing wrong? Thanks 

View 3 Replies View Related

Strange Behavior

Feb 1, 2008

 I've done a new tabel that insert the UserId that in a uniqueidentifier get from Membership.GetUser().ProviderUserKeySo if I want to make a select statement threw storedprocedure in codebehind it runs as it shouldCode behindDim GetCustomersCars As CustomerCarByUserId = New CustomerCarByUserId MyCars.DataSource = GetCustomersCars.CarByUserId(Membership.GetUser().ProviderUserKey)MyCars.DataBind() But in when I use ObjectDataSource it fails<asp:ObjectDataSource id="ObjectDataSource1" runat="server" selectmethod="CarByUserId"                            typename="CustomerCarByUserId">                            <SelectParameters>                                <asp:Parameter defaultvalue="Membership.GetUser().ProviderUserKey" name="UserId" type="Object" />                            </SelectParameters>                        </asp:ObjectDataSource>I've tried with Membership.GetUser().ProviderUserKey.ToString(), but that doesnt work. Error message:InvalidCastExceptionI connect to the same source in both cases.Any one with an Idee ?

View 1 Replies View Related

A Strange Error Here...

May 13, 2008

So we currently are running a SQL 7 Server, which hopefully we will be updating this year but untill then we're stuck.  I've got a web app using ASP.NET 2.0 and on occasion I get this error:
System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - Only one usage of each socket address (protocol/network address/port) is normally permitted.) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open()

View 2 Replies View Related

Very Strange Error Can Anyone Help With .

Mar 25, 2004

I Some sql that it keeps throwing the following error

SqlDumpExceptionHandler: Process 52 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

Here is the sql

UPDATE dbo.temptable
SET code = 'MM'
FROM dbo.temptable T
JOIN dbo.Item I WITH (NOLOCK)
ON T.ProductID = P.ProductID
JOIN dbo.cars C WITH (NOLOCK) ON I.ModelID = C.ModelID
JOIN dbo.carmakes CM WITH (NOLOCK) ON CM.MakeID = C.MakeID
JOIN dbo.CarDealerMakes CDM WITH (NOLOCK)
ON CM.MakeID = CDM.MakeID
WHERE T.ProductID NOT IN (

SELECT distinct A.ProductID
FROM dbo.Action A WITH (NOLOCK)
JOIN dbo.ActionPurchases AP WITH (NOLOCK)
ON A.ActionID = AP.ActionID
WHERE A.CustomerID = 2

UNION

SELECT distinct A.ProductID
FROM dbo.Action A WITH (NOLOCK)
JOIN dbo.ActionServices S WITH (NOLOCK)
ON A.ActionID = S.ActionID
WHERE 2 = A.ProductID)

That sql will run on windows 2000 but it will not run on windows 2003.
I have the latest service pack.

Has anyone ever come across this before or have and suggestions ?

View 2 Replies View Related

Strange In Query

Jul 9, 2005

I have a query as follow:
SELECT @resRate = (SELECT resRate FROM ProjectAssign WHERE proNo =                                                             (SELECT projNo FROM Timer_Cust WHERE refNum = @actProjNo  AND                                                                        username= (SELECT username FROM Timer_Emp WHERE refNum = @actEmployee)                                                             )                                        )
 the definition of table Timer_cust contains refNum(int),  projNo(varchar) and projName(varchar).Timer_cust table doesn't contain column username. So  this query shoud generate a runtime error. however it works fine without error.But if I run                      SELECT projNo FROM Timer_Cust WHERE refNum = @actProjNo  AND                                                                        username= (SELECT username FROM Timer_Emp WHERE refNum = @actEmployee)A runtime error message appears.Why?

View 3 Replies View Related

Strange Indexes

Aug 13, 2001

Can any one tell me why sp_helpindex shows several indexes though there is only one index on the table. When i use Enterprise manager it shows only one index..Any idea..is it a bug ..do I need to apply latest service pack ?

Here is the output shows

IX_tbl_ncf_bo
_WA_Sys_Deal_No_2902ECC1
_WA_Sys_fwddate_2902ECC1
_WA_Sys_deal_type_2902ECC1
_WA_Sys_RegionID_2902ECC1
_WA_Sys_CompID_2902ECC1
_WA_Sys_To_Include_2902ECC1
_WA_Sys_SvcChoice_2902ECC1
_WA_Sys_UtilityID_2902ECC1

First one is actual index that I created, remaining

View 1 Replies View Related

Strange!any Explanations????

Jul 31, 2000

i have four separate jobs which run at scheduled time daily..out of which one job has run properly and the other three have not run at all(there is no details of it in "View job history")for only one day in between..again from the next day all the four jobs are running properly.what could be the reason for the three jobs not running on a particular day?(The jobs were scheduled between 3 and 4am in the morning..so nobody would be using the system at that time and the system was definitely up at that time as that one job has run)
i could afford to have such strange behaviour in future as the jobs are important and should run daily.any ideas by which i could make sure all four jobs run daily?

View 6 Replies View Related

Strange Indexes.

Feb 6, 2001

We've been finding some strange indexes in our SQL 7 database. They are not indexes we put in, but seem to be system generated. They always have the format "hind_" and then a series of numbers and underscores. Most of the time they replicate indexes we already had in place. The strangest part is that in some cases they seem to be generating multiple clustered indexes on the same table. A previous question recieved an answer saying that they were statistical indexes. Could someone shed a little more light on what these are, where they came from, and how I can prevent them from coming back? Our queries usually take much longer on tables with these "rogue" indexes on them. Thanks.

View 1 Replies View Related

Strange Len Function

Mar 13, 2003

Why is it so?

select len("Test")
--returns 4

select len("Test ")
--returns 4

select len(" Test ")
--returns 7

why not all 4 ?
why not 4,11,14?

View 6 Replies View Related

Strange Behavior

Nov 29, 2005

I have a SP that usually works fine (0-16 CPU time, 40 ms Duration), but from time to time the server hangs with apparently no reason. The SP has a lock timeout set to 500, so it should abort if a lock timeout error (1222) occurs but it doesn't. The Profiler reports very long execution time (over 30 sec), and because of that all other SP calls are blocked, 'cause the transaction opened by the first sp execution is not finished yet.
Any other attempts to identify other blocking queries did not show me anything suspect (sp_lock, dbcc opentran) other then the usual blocked chain. I'm starting to think about an IO bottleneck, or IO failure, that could block the disk access and cause the delay. The status of RAID 5 is healthy.

The server is used as storage system for a website (approx. 2000 concurrent users), and occasionally I noticed an ASP queue, but this strange behavior occurs even during the peak-off hours.


Any thoughts ?
-----
HP Server - 2 CPU @ 3,4 ; 4 GB RAM; SCSI - RAID 5
Windows 2000 Advanced Server - SQL Server 2000 SP4

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved