Here is my procedure
CREATEPROCEDURE mysp
@id int
@param1 int
@param2 int
@param3 datetime
@param4 bit
AS
DECLARE @tv TABLE
(
param1 INT
)
INSERT INTO @tv ( param1 )
SELECT param1 FROM tbl1 WHERE id = @id and IsActive = 1
INSERT INTO tbl2
(
id
,param1
,param2
,param3
,param4
)
VALUES
(
// all recors from @tv
,@param1
,@param2
,@param3
,@param4
)
@tv will have multiple records i want to insert each value of param1 in @tv insert into another table along with other parameter param1, param2, param3, param4. Something like this
Is there a way of doing this. i dont want to use any cursor for this .
Thanks. help will be really appreciated.