0

I'm working on an application for a joint-stock company.

A joint-stock company is a business entity which is owned by shareholders. Each shareholder owns the portion of the company in proportion to his or her ownership of the company's shares (certificates of ownership). This allows for the unequal ownership of a business with some shareholders owning a larger proportion of a company than others. Shareholders are able to transfer their shares to others without any effects to the continued existence of the company.

Shares are collected in a form of a deed. A deed has classes like a deed of 50, a deed of 40 and so on.
50 and 40 means that a deed consists of 50 shares, 40 shares and so on.

A joint-stock company may have a 1000 shares that are distributed in the form of deeds. each deed has a start share number and an end share number for example lets take a deed of 50 shares so its shares will start from share no. 1 to share no. 50.

Within the database of the company there is a table to store the information of each deed

DEED (DEED_NUMBER, START_SHARE, END_SHARE) if we use the previous example of deed of 50 and lets say that the deed number is 100. So the data will become 100 for DEED_NUMBER, 1 for START_SHARE, and 50 for END_SHARE.

What I need is to get all the numbers between 1 and 50 and this will be applied to all the deeds. So if I had a 1000 shares distributed in deeds I need to get the numbers 1, 2, 3, 4, .... 1000.

I already used a cursor to make such solution through looping on all deeds one at a time getting its start share number and its end share number and get all the numbers between them. However, this solution taking too much time and with a company like the one I'm working on having more than 100,000 to 150,000 deeds the time my solution takes to retrieve shares numbers is unbearable and unacceptable.

Thanks for any help and I'm sorry for long post I just wanted to explain what is the mean of joint-stock company so people know what I want.

I already make a

2
Contributors
1
Reply
15
Views
3 Years
Discussion Span
Last Post by Kyle Wiering
0

Indeed, cursors are intrinsically slow (but don't lock tables as much). What is preventing you from using a set based approach? What does your dataset look like? Constructing this type of query depends entirely on how well formed your data is.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.