-
April 21st, 2009, 01:12 PM
#1
table locking
I have written app using sql server as backend, it just a simple reporting,
i have created a X table to store data taken from various table and use the X table as source for reporting, if one user is accessing the x table to generate report its 100% Ok, but if by change another user generate a report using X table as well, user 1 extracted data is being included in user 2 extracted data.
How can i prevent other user to access the table until the fist user has completed his report.
i've tried adlockpessimistic and open static not working
tnx
cyrus
-
April 21st, 2009, 01:51 PM
#2
Re: table locking
Do you mean to say that you dump the data into a table X when a user requests a report? If that is the case then you will have this kind of problem where data would be stale or not correct for most of the cases when concurrent users use your tool. And this is the not the right way to write a reporting app.
The correct way would be to dump all records into one table and then query from this table. You could use a nightly job to dump all your reporting data into a single table, or you can run the job at regular intervals. If you are using SQL 2005, you could also try looking into partitioning. You could also use a simple view.
I am not sure about your requirement, if this doesn't help you, could you elaborate on what exactly ou are trying to do.
-
April 21st, 2009, 03:19 PM
#3
Re: table locking
Add two more fields. One for EMP# that can view, and also a DELETE flag, so you know when to do garbage collection.
-
April 24th, 2009, 12:41 AM
#4
Re: table locking
Have you ever tried Table Type of Data in SQL Server?
Encourage the efforts of fellow members by rating
Lets not Spoon Feed and create pool of lazy programmers
- ComIT Solutions
-
April 27th, 2009, 11:08 AM
#5
Re: table locking
Originally Posted by Shuja Ali
Do you mean to say that you dump the data into a table X when a user requests a report? If that is the case then you will have this kind of problem where data would be stale or not correct for most of the cases when concurrent users use your tool. And this is the not the right way to write a reporting app.
The correct way would be to dump all records into one table and then query from this table. You could use a nightly job to dump all your reporting data into a single table, or you can run the job at regular intervals. If you are using SQL 2005, you could also try looking into partitioning. You could also use a simple view.
I am not sure about your requirement, if this doesn't help you, could you elaborate on what exactly ou are trying to do.
Following ur suggestion problem has been resolve,by maintaining the query for selection criteria of data to be reported.
thnks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|