Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: MSSQL stored procedure


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Oct 8, 2015 1:54 PM Last Post By: William McDonald Threads: [ Previous | Next ]
William McDonald

Posts: 3
Registered: 10/2/08
MSSQL stored procedure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2015 11:21 AM
I am using Delphi 2010. I am working on an integration project. Both programs use MSSQL databases. One of them has an existing stored procedure that keeps track of sequence numbers stored in a table. It handles the record locking for me, so I would really prefer to make use of it. The procedure does a SELECT to get the current value from the table, increments it and then does an UPDATE to save the new value and then does a SELECT on the variable for the new number to provide a one record result set. (This is all done in a transaction so multiple users can't pull the same number) I have not been able to find a way to get the new value back AND save the updated value to the table.

I have tried:

TQuery that runs an EXECUTE statement: Updates the Sequence table, returns nothing.

TStoredProc.GetResults: does nothing

TStoredProc.Open: returns NextValue, does not update the Sequence table.

TStoredProc.ExecProc (this is an alternate version that has OUTPUT parameters instead of SELECT ing the variables set in the procedure): does nothing. no update, parameter not set.
William McDonald

Posts: 3
Registered: 10/2/08
Re: MSSQL stored procedure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2015 1:54 PM   in response to: William McDonald in response to: William McDonald
I guess I was struggling with this for too long. I was mistaken. The TQuery does work.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02