Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 28th, 2004, 01:15 AM
Registered User
 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Transactions in stored procedure

Hi All,

I am using one stored procedure which have more than 25 queries in it which returns almost same no. of recordsets. now the problem is that when the execution of stored procedure is going on it takes 5 to 9 seconds so in between this time somebody change something in database using interface (means some values) then it takes the newly changed values. i mean to say that if stored procedure executes 10 queries then the result is of before change any value but in between the time somebody change any value then it takes the changed values for next few or remaining queries. i have used BEGIN TRANS and COMMIT TRANS but it seems not working.

can any body help me on this.

Regards,
Deepak

 
Old October 28th, 2004, 03:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

You need to use the SET TRANSACTION ISOLATION LEVEL command to prevent other users changing the data during your transaction. You probably want to use REPEATABLE READ, but look it up in BOL and choose which level best suits your scenario.

5 - 9 seconds is quite a long time to hold on to locks, if you have a lot of users then blocking updates for this long will not be good for performance...
 
Old October 28th, 2004, 03:27 AM
Registered User
 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks phil,
do you have any sample code related with same, actually i am new to SQL Server Transactions. And about execution time, how can i reduce it? actually its only the stored procedure in my system which is so longer and even i cant reduce the queires in it.






Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure prashant_telkar SQL Server 2000 1 July 9th, 2007 07:57 AM
Transactions in C#, not stored procs organicglenn BOOK: ASP.NET Website Programming Problem-Design-Solution 6 October 10th, 2004 09:18 AM
Stored Procedure desireemm SQL Language 5 September 18th, 2004 02:34 AM
Stored Procedures and transactions Gert SQL Server 2000 1 March 3rd, 2004 07:43 AM
C# and stored procedure Msmsn C# 1 August 26th, 2003 11:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.