We help IT Professionals succeed at work.
Get Started

Inserts and using cursors in multi-user environment (T-SQL)

ericvb
ericvb asked
on
365 Views
Last Modified: 2008-03-04
I declared a cursor to move around in my table (next, prior, ...). To see modifications and deletions, I declared the cursor 'dynamic'. So if someone (another application) is changing a row, I will see it when I fetch the row.

What if another application inserts a row into the base table? I won't see it until I close and reopen the cursor.

How to manage that?
Can application 1 receive a message from application 2 to close his cursor and reopen it because application 2 inserted a row?
Or can the server send a message to all the applications connected to this database?

I can't close and reopen the cursor every time that I fetch a record :
1. I lose the current record, so I must provide a mechanism to avoid this
2. because the select statement in the cursor is complicated, opening the cursor will take some time
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE