Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to write query?????????

Author  Topic 

samsun125
Yak Posting Veteran

63 Posts

Posted - 2009-09-04 : 01:23:58
Hi Friends,

I have one query , from frontend i am sending labname,labdesc,labrate,remarks fields

but for to store these values i am using two tables.
1.labtest colums are labid,labname, labdesc,remarks
2.labtestrate columns are labrateid,labid,labrate

how to store these values in two tables at a time using one stored procedure in sql server

Thanks
Rama

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-09-04 : 01:26:41
create proc test
(
@labname varchar(32),
@labdesc varchar(64),
@labrate decimal(18,2),
@remarks varchar(max)
)
AS
SET NOCOUNT ON
BEGIN
declare @id int

insert into labtest select @labname,@labdesc,@remarks

select @id = scope_identity()

insert into labtestrate select @id,@labrate


END
SET NOCOUNT OFF
Go to Top of Page
   

- Advertisement -