BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Strange Microsoft SQL Server Stored Procedure Behavier

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
Volkmar
Guest





PostPosted: Fri Nov 28, 2003 11:59 am    Post subject: Strange Microsoft SQL Server Stored Procedure Behavier Reply with quote



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





PostPosted: Fri Dec 05, 2003 5:41 pm    Post subject: Re: Strange Microsoft SQL Server Stored Procedure Behavier Reply with quote



no one else had this problem?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.