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 

SPROC: INSERT into two tables

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





PostPosted: Fri Aug 13, 2004 7:38 am    Post subject: SPROC: INSERT into two tables Reply with quote



Hi all.

I want to use a Stored Procedure to insert values into two tables.
After insert in the first table i want to use returning ID to insert the
other values into another table.
Inserting values in the firtst table runs good, but nothing happens in the
second table. can anybody tell what i am doing wrong?
Here my SPROC:
CREATE PROCEDURE [sp_ins_studio]
( @stud_name [varchar](50),
@stud_inhaber [varchar](50),
@adr_typ [varchar](50),
@adr_con_typ [varchar](50),
@adr_con_id int,
@adr_strasse [varchar](50),
@adr_plz [varchar](10),
@adr_ort [varchar](50),
@adr_land [char](10),
@adr_postfach [char](20),
@ACTIONUSER [varchar](50)
)

AS INSERT INTO [DelphiWebStore].[dbo].[studio]

( [stud_name],
[stud_inhaber])

VALUES
( @stud_name,
@stud_inhaber)
RETURN

INSERT INTO adressen
(
[adr_typ],
[adr_con_typ],
[adr_con_id],
[adr_strasse],
[adr_plz],
[adr_ort],
[adr_land],
[adr_postfach],
[ACTIONUSER]
)
VALUES
(
'ANSCHRIFT',
'FIRMA',
@@identity,
@adr_strasse,
@adr_plz,
@adr_ort,
@adr_land,
@adr_postfach,
'TEST'
)
GO


Thanks
Oliver


Back to top
Bill Todd (TeamB)
Guest





PostPosted: Fri Aug 13, 2004 1:51 pm    Post subject: Re: SPROC: INSERT into two tables Reply with quote



The following is from Books Online:

RETURN
Exits unconditionally from a query or procedure. RETURN is immediate
and complete and can be used at any point to exit from a procedure,
batch, or statement block. Statements following RETURN are not
executed.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) 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.