 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Oliver Guest
|
Posted: Fri Aug 13, 2004 7:38 am Post subject: SPROC: INSERT into two tables |
|
|
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
|
Posted: Fri Aug 13, 2004 1:51 pm Post subject: Re: SPROC: INSERT into two tables |
|
|
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 |
|
 |
|
|
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
|
|