Puzzled By Concurrent Update

May 6, 2006

I have a puzzle in my mind here. I will thank anyone who can solve my puzzle.

I am not familiar with SQL and its theories behind, so please bear with me if I am asking a stupid newbie question.

My puzzle is generally a problem of generating sequence numbers. The following SQL is only a stripped down version - it fetches the max number, add 1 to it and updates the table with the new number.

DECLARE @max int

SELECT @max = MAX(next_number) + 1 from sequence_numbers

UPDATE sequence_numbers SET next_number = @max WHERE next_number = @max

Now if user1 gets 100 and user2 also gets 100 and they both try to update the table, what would happen? I fear that the result would be 101.

One of my coworker thinks that adding 'WHERE next_number = @max' can solve the conflict - user2 will fail. His reasoning is like this:

After user1 updates the table, next_number would be 101 and user2's update will fail because his WHERE criteria is still 100.

But I think user2 still sees the old data (100) and still succeeds and thus both users update the table with number 101.

Thanks.

 

View 10 Replies


ADVERTISEMENT

Concurrent Insert And Update Commands

Mar 20, 2006

Hi there,

I've had a look at this thread - http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=104399&SiteID=1 - but it's a bit old so I thought I'd try to clarify a couple of things.

I have a data flow which inserts or updates a table in a SQL 2000 database.

The insert is done via an OLE DB destination and the update is done via an OLE DB Command.

As stated in the previous thread, when these commands run concurrently issues arise with blocking etc.

The only way I've managed to get around it is by setting the access mode of the insert to OpenRowset.

So 2 questions:

1) Does anyone know how this problem occurrs and what the best way to get around it is?

2) Are there issues around NOT using the fast load options - I've read stuff about the double-byte character set etc but I admit I don't quite understand it.

Thanks.

View 2 Replies View Related

Problem With Concurrent Insert And Update Commands

Oct 7, 2005

I've got a quite simple data task.

View 13 Replies View Related

The Problems Puzzled Me A Lot

Dec 1, 2006

HI, i'm new to SSIS,i got some problems puzzled me a lot, when i drag a OLEDB destination in the data flow task, i select a table or view as the destination or write a sql like "select * from destination_table", my purpose is only to get the fields to map for, why SSIS retrive all data from the destination table,the consequence of that is the great consumption of RAM,if the number of records of the target table exceed 1.000.000,SSIS always terminated with a 'out of memory' info,my laptop has 2GB ram,i have already solve the problem by writing the sql like "select * from destination_table where 1=0" in oledb destination,but i still want to know the cause why SSIS doing that?

And the other problem i encountered is the efficiency of inserting data,the normal speed is about 10.000 rows per minute,you know it is very slow,anyone who knows how to perform well,my destination database is oracle.



Thanks a lot!

View 1 Replies View Related

Puzzled By Query Plan

Jul 20, 2005

I'm hoping somebody can explain exactly what's going on here - I can'tfind it documented anywhere.Go to the Northwind database, and run the following SQL:create index IX_UnitPrice on [order details](unitprice)Now, turn on SHOWPLAN (either graphical or text, it doesn't matter),and run the following query:select * from [order details]where unitprice = 2Output:StmtText|--Index Seek(OBJECT: ([Northwind].[dbo].[OrderDetails].[IX_UnitPrice]), SEEK: ([OrderDetails].[UnitPrice]=Convert([@1])) ORDERED FORWARD)Now, alter the SARG slightly by making it a float:select unitprice from [order details]where unitprice = 2.000Output:StmtText|--Nested Loops(Inner Join, OUTER REFERENCES: ([Expr1003], [Expr1004],[Expr1005]))|--Compute Scalar(DEFINE: ([Expr1003]=Convert(Convert([@1]))-1.00,[Expr1004]=Convert(Convert([@1]))+1.00, [Expr1005]=If(Convert(Convert([@1]))-1.00=NULL) then 0 else 6|If(Convert(Convert([@1]))+1.00=NULL) then 0 else 10))| |--Constant Scan|--Index Seek(OBJECT: ([Northwind].[dbo].[OrderDetails].[IX_UnitPrice]), SEEK: ([Order Details].[UnitPrice] >[Expr1003] AND [Order Details].[UnitPrice] < [Expr1004]), WHERE:(Convert([Order Details].[UnitPrice])=Convert([@1])) ORDERED FORWARD)Right. I understand that in both cases the SARG datatype is differentfrom the column datatype (which is money), and that in the firstexample the SARG constant gets implicitly converted from int -> money(following the datatype hierarchy rules), and so the index can stillbe used.In the second example, the datatype hierarchy dictates that money islower than float, so the table column gets implicitly converted frommoney -> float, which strictly speaking disallows the use of the indexon that column.What I DON'T understand is what exactly all that gubbins about theexpressions (especially the definition of [Expr1005] is all about; howdoes that statement decide whether Expr1005 is going to be NULL, 6, or10?I'm soon going to be giving some worked tutorials on index selectionand use of Showplan to our developers, and being a bolshi lot they'rebound to want to know exactly what all that output means. I'd ratherbe able to tell them than to say I don't actually know!How about it someone?Thanks,Phil

View 4 Replies View Related

Puzzled By Config Files

Jul 12, 2006

I created a package, created an XML Config file, created a deployment utility and then deployed to server. I scheduled it with agent and I get this error (changed the package name in the error to IMPORT to make it more readable):

Description: The configuration file name "C:Documents and SettingschrisMy DocumentsVisual Studio 2005ProjectsIMPORTIMPORTIMPORT.dtsConfig" is not valid. Check the configuration file name.  End Warning  Warning: 2006-07-12 13:11:39.96     Code: 0x80012059     Source: IMPORT      Description: Failed to load at least one of the configuration entries for the package. Check configurations entries and previous warnings to see descriptions of which configuration failed.  End Warning  Progress: 2006-07-12 13:11:40.56     Source: Import Data      Validating: 0% complete  End Progress  Progress: 2006-07-12 13:11:40.56     Source:...  Process Exit Code 1.  The step failed.

So basically its trying to point to a config file on my dev workstation.  When I created the deploy utility it created a config file in the Deployment directory with the Manifest and the package.  I installed from the deployment directory. When installing it asked where I wanted to install and I left it the default of "C:Program FilesMicrosoft SQL Server90DTSPackagesIMPORT" and if I look in that folder the IMPORT.dtsconfig is there.

Ideas of where I went wrong?  I want to make sure I understand the whole configuration file notion correctly as I am starting to roll a bunch of packages with config files out to production.  I've done the tutorial and thought it was straightforward and made sense.  I can fix it by editing the xml of the package and removing the line pointing to my dev box - just want to know what I am doing wrong :)

View 1 Replies View Related

Puzzled By Installation Error.

Nov 5, 2006

I have tried installed several times the SQL Server 2005 Express (Standard or Advanced Services) on my XP SP2 system and all failed.
The error messages are all about the Secure Socket Layer certificate and provider, either cannot find, create valid SSL certificate or the authentication provider is not trust (actually I don't know any of this and where to find them). I am learning at home the SQL Server and not going to do a website. Why I need a SSL? Or if it is really necessary, how do I obtained one?
I installed IIS (supposedly 5.0 since I have XP SP2), is this related? How to install without IIS?

Or do I need a Server OS?

View 3 Replies View Related

25 Concurrent Connections

Mar 16, 2004

Hey,

MSDE 2000 allows 25 concurrent connections.

If these are all used up, and a 26th connection comes in. What happens? is the connection rejected? or does it sit in a queue, waiting to be given a connection?

Thanks,
-Ashleigh

View 2 Replies View Related

Ms-sql 7 Concurrent Connections

May 8, 2002

hi
i hv developed an application that runs on the local windows system and interfaces with the MSSQL 7.0 database server using ODBC DSN Connections. This application will be deployed over the LAN with over 100 users.

The MSSQL 7.0 server has only 5 user licenses that limits the concurrent usage to 5 users.

I need a solution whereby all users can access the SQL server database without adding more licenses

Is there a way out.

Please help

Regards
JD

View 2 Replies View Related

Concurrent Connections

Nov 30, 2007

Morning

I have been searching hi and low on the web to try and find out typically which version of sql server should be used based on the number of concurrent users you will be having.

I believe that Sql Server 2005 Express should only really be used for up to 10 concurrent users while I seem to remember that Standard edition supports up to approx. 33,000 connections.

Does anybody have this information to hand as I need to write a business case to justify the potential upgrade.

Many thanks

James

View 3 Replies View Related

Concurrent Users

Dec 16, 2005

Hi,Is it possible to have many different clients conncecting to a web basedserver all using, simultaneously, the same DSN-less connection string heldin a server side include file?Many thanksRay Allison

View 2 Replies View Related

Concurrent Run Of A Package

Feb 29, 2008

what happens when a package is run concurrently by 2 or more users. will the flow be in a queue, if not how is it going to be.

Thanks .

View 11 Replies View Related

Control Concurrent Users?

Aug 24, 2006

    is it possible to limit the concurrent users in SQL connection string? Now, i m using .net 2003.regards,

View 3 Replies View Related

MDSE Concurrent Connections.

Nov 6, 2003

hey all,

MSDE will only allow 5 concurrent connections to ...

a particular database?
a particular instance?
or a particular server?

ie. if i have one application running on one instance of MSDE with 5 connections and i have another application running on another instance of MSDE with 5 connections. would i actually have 10 connections? **both instances on the same machine...

can someone please clarify.

TIA

Chris

View 2 Replies View Related

MS Access Concurrent Users

Nov 7, 2000

Hi,

Does anyone know is MS Access has any limited no of users, or how many concurrent users MS Access has?

Thanks

View 2 Replies View Related

Concurrent Users...URGENT!!

Jul 20, 2000

I need to know how many concurrent users are allowed to access the database at any point of time.Will it depend on the type of licence?Where do we set this parameter.Some users are complaining 'time out' problem.Thanks for any help!

View 1 Replies View Related

Concurrent User Information

Nov 29, 2007

dear folks,

Does anyone know how can I get concurrent user information on Microsoft SQL Server 2000/2005….?

Thanks

cheers
sbahri

View 2 Replies View Related

Concurrent Stored Procs?

Mar 8, 2004

Hi all

I have a stored proc that runs every 4 hours - as a job. The stored proc takes about 3-5 minutes to comple, depending on number of records.
To do testing we run that stored proc manually, also.
Sometimes 2 or more people may run the same stored proc without knowing that the other person is running. This may create duplicates entries once processed.

What I want to know is, Is there a way to check if that stored procedure is currently running. If so it wont run second time concurrently.
(May be semapohres,mutex or something like that?)

(I am trying not to use a table to store whether the stored proc is running or not)


Thanks in advance.

Rochana

View 10 Replies View Related

Concurrent Queries Error

Jul 23, 2005

On my server running SQL Server 2000 (SP3). I frequently get thisinformational message in the Event Viewer log.17052 :This SQL Server has been optimized for 8 concurrent queries. This limit hasbeen exceeded by 2 queries and performance may be adversely affected.The application that I am running is a vendor application so I do not haveaccess to the code. I contacted the vendor, but they have never seen thisproblem and cannot recreate it. I checked the Microsoft Knowledge Base forhelp, but I came up empty. It seems like it should be a simpleconfiguration change.Any advice?Thanks,Jeff

View 1 Replies View Related

Technique For Concurrent Access?

Jul 20, 2005

I've been asked to turn our single-user database system into a multi-usersystem. At present, each user has a copy of the MSDE on their desktopmachine and uses our program to access it. In future, we would like tocentralise our MSDE instance and allow multiple users to access it. Inorder to facilitate this, we are going to only allow one user write accessto the system at a time (I know, its a kludge, but the system was neverdesigned for multiple users in the first place).I have a single, simple question this being the case: can I update a single"read-only" bit field in a table of the database in order to flag to otherusers that the system is in read-only mode in a way that avoids concurrencyissues? ie. does an "UPDATE" query lock and unlock? ( I suspect the answeris yes! ). If anyone else has experience of these things, I would alsoappreciate some tips on how best to proceed.ThanksRobin

View 7 Replies View Related

Concurrent Connection Limits

Jul 25, 2007

I'm new using SQL 2005 Express

I'm planning to use SQL Server Express 2005 for a asp net web application for a video rental store.

Is there a concurrent user conection limit that I should care?



TIA

Gerardo

View 1 Replies View Related

Number Of Concurrent Users

Apr 13, 2006

Hello,

There was a 5 concurrent user limitation in MSDE (the version prior to SQL Express). Does that same limitation exist with SQL Express 2005?

Thanks.

View 3 Replies View Related

Group By Concurrent Years

Nov 8, 2007



Hi and thank you in advance to whomever takes the time to read this entry. I will be as detailed as possible, so I apologize for the length. The information here relates to the automotive industry, but I don't believe that is a very important detail

The overall purpose of this query is to create a compressed set of the data that exists in the database. The de-normalized information is structured like the following (including made-up data):




Code Block
PartNumber Make Model Year
-------------------------------------------------------
835100 ACURA INTEGRA 2004
835100 ACURA INTEGRA 2003
835100 ACURA INTEGRA 2001
835100 ACURA INTEGRA 2000
835100 FORD FOCUS 2002





There is any number of part numbers, makes, etc in this mix. The query that I currently use is utilizing MAX and MIN functions to determine year range, but as in the sample above, this does not take into account the fact that there could be a year skipped in the middle. I could probably use a cursor to do this, but would really like to stick to set logic if at all possible.


My existing query is:




Code Block
SELECT DISTINCT
cwi.PartNumber
,RTRIM(lv.Make) AS Make
,MIN(lv.Year) AS StartYear
,MAX(lv.Year) AS EndYear
FROM
CWIParts AS cwi
INNER JOIN PartTypes AS pt
ON cwi.PartTypeID = pt.PartTypeID
INNER JOIN PartDetail AS pd
ON cwi.PartNumber = pd.PartNumber
INNER JOIN Status AS s
ON pd.StatusCode = s.StatusCode
INNER JOIN LegacyVehicle AS lv
ON cwi.LegacyVehicleID = lv.LegacyVehicleID
WHERE
cwi.PartTypeID = 10
AND s.Status = 'Active'
GROUP BY
lv.Make
ORDER BY
cwi.PartNumber ASC
,cwi.Make ASC





In hopes to end up with a result set that has 1 row for each unique part-number, make, and consecutive year range relevant to the part-number and make. I will also need to add the functionality to add other attributes (such as Model and Liters), but those are equality based and can be passed in easily.


I had done most of this programatically in vb.net, but I would much rather push this logic back to SQL Server. Thank you all for any help that you can provide on this topic.

- Jay Soares

View 9 Replies View Related

Concurrent Connections Limit

May 18, 2008



Hi,
I read that there's a "tecnical" limit of 32767 concurrent connections for SQL 2005 Express, and that SQL 2005 Express uses only 1GB of memory. So, what's the number of practical concurrent connections SQL 2005 Express can handle? Is it 200 ,300, 0r 400...? How much memory is consumed by every connection?
Thanks in Advance.

View 10 Replies View Related

Multiple Concurrent Sql Exec Commands?

Mar 12, 2008

I was wondering if it was possible to run 2 queries at the same time,IE rather than runningexec query1  exec query2 and having to wait for query1 to finish before query2 started, just have them run at the same time (they're not conflicting).I want to do this in TSQL, not by opening another query window in vs2005. 

View 2 Replies View Related

Change Number Of Concurrent Connections

Oct 22, 1999

Does anyone know how to change the number of conccurent connections on SQL Server 7. We have purchased 10 additional licenses and I need to change the concurrent users from 10 to 20. Any help would be appreciated. Thanks

Phil

View 2 Replies View Related

Database Concurrent Access Issue

May 22, 2007

Dear All,

I have this .NET application that inserts lucky draw entries into SQL server. Each entry may have a range of values that the winning number will be drawn from. For example,

Entry 1: [1, 2]
Entry 2: [3, 8]
Entry 3: [9, 10]
Entry 4: [11, 11]
Entry 5: [12, 20]

The winning number will be picked from [1, 20]. Given this scenario, what is the best design that can handle the concurrency issue? If two entries are input at the same time, how to make sure it won't have the same starting value? Anyway to lock a table when one is accessing, disallowing other to run select query?

Thanks.

View 4 Replies View Related

2005 Express - Concurrent Connections

Jul 23, 2005

Hi all !Does someone know how many concurrent connections 2005 Express canaccommodate ? The limit on MSDE was 5 before performance drops considerably.Thanks for your help.Sebastian

View 1 Replies View Related

Web Synchonization Performance &&amp; Concurrent Users

May 24, 2006

Hi

I need some rough figures for replication performance. Can anyone give an idea of the number of concurrent subscribers a single IIS server can safely handle before having to move to load balancing with multiple IIS servers.

I would estimate the average daily row changes to be in the region of 500 to 2500 per subscriber.

Any ideas?

Many thanks

RL

View 1 Replies View Related

DB Engine :: Concurrent Inserts Into Same Table

Jun 26, 2015

I have a table into which the inserts will be done by multiple users at the same time;

The table has a primary key, non clustered, on unique id; each insert will have unique id, which is a seqence generated number, so they are always different for different transactions.

Is this possible to set the settings of sql server in such a way, that these inserts are done at the same time i.e. during insert by one user that table is not locked so that other inserts can take place at the same time as well?

View 6 Replies View Related

DTC Error With Concurrent Data Flows

Feb 6, 2006

I have a package that has several data flows that run concurrently after some initial tasks and an initial data flow. I want transactions on each of the data flows and have set the transaction option to Required on the data flows (not on the package itself). I am also using checkpoint restart on the package. A couple things are happening.

1) the first data flow is successful and that releases the several that are waiting. Some of these complete OK but inevitably one or two will fail. The failing data flows will be different from run to run, sometimes one and sometimes two will fail. The error says:

Error: 0xC0202009 at Provider_NF_Code, Delete Provider_NF_Code [130]: An OLE DB error has occurred. Error code: 0x80004005.

An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.".

My hunch is that DTC is getting the transactions mixed up. I think it is committing one just after another data flow has already started work expecting the transaction to still be active. That would explain why the failing data flows are random. Plus, if I set the MaxConcurrentExecutables to 1 the entire package is successful. BUT, why have concurrent tasks if you can't run them concurrently.

2) when the package fails with the DTC problem I restart it with the checkpoint file. I was expecting the package to restart with the failed data flows. Instead, it restarts with the initial data flow (that all the other flows wait for in the package). This data flow has always been successful. It's as if the transactions I have put on the individual data flows are actually placed on a single virtual container that all of them are in, and when down stream data flows fail the entire data flow chain is rolled back and set to restart.

How can I get multiple concurrent data flows to run with transactions?

Why are successful data flows being restarted? Can I get just the failed tasks to restart?

-Gordy

View 5 Replies View Related

Concurrent User On WinXP Prof

Nov 21, 2007

When running MS SQL Server on a Windows XP Pro OS, is there a limit to the number of concurrent users or connections to the database? We want to run server for education in the high school (MS Select licence), we need 16 concurrent connections.

Thanks for any help.

View 3 Replies View Related

Concurrent (completely Independent) Statements.

Aug 31, 2007

Hi!

We are migrating an DB2 database to sql server 2005. We have used the 1.2 jdbc driver. It consumes lots of memory when we have several resultssets opened on different statments. Then we tried JTDS (http://jtds.sourceforge.net/), it worked fine. It's supports concurrent staments. We would like to stick with microsofts driver. My question is: will we se this supported in microsofts driver (soon)!

Joachim

View 2 Replies View Related







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