 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Volkmar Guest
|
Posted: Fri Nov 28, 2003 11:59 am Post subject: Strange Microsoft SQL Server Stored Procedure Behavier |
|
|
hello...
i've the following situation (delphi 7, dbexpress driver 7.0.2.113,
MSSQL 7):
CREATE TABLE ID_TAB
(
ID int IDENTITY (1, 1) NOT NULL,
UniqueLock uniqueidentifier NOT NULL
)
CREATE PROCEDURE P_GET_ID AS
begin
DECLARE @MyLock UNIQUEIDENTIFIER;
DECLARE @ID Integer;
Set @MyLock = NewID();
insert into ID_TAB (UniqueLock) values (@MyLock);
Select @ID = ID from ID_TAB where UniqueLock = @MyLock;
Delete from ID_TAB where UniqueLock = @MyLock;
Return @ID;
end;
To call this Procedure, i use the following code:
with SQLDataSet1 do
begin
CommandType := ctStoredProc;
CommandText := 'dbo.P_GET_ID';
ExecSQL;
ShowMessage('NEW ID IS: ' + ParamByName('RETURN_VALUE').asString);
end;
The strange thing is, that for the first 2 calls the RETURN_VALUE is
0, then anything works fine...
any ideas?
volkmar
|
|
| Back to top |
|
 |
Volkmar Guest
|
Posted: Fri Dec 05, 2003 5:41 pm Post subject: Re: Strange Microsoft SQL Server Stored Procedure Behavier |
|
|
no one else had this problem?
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|