|
sanjeevka08
Starting Member
India
11 Posts |
Posted - 10/11/2012 : 02:57:37
|
i am having a TVP data as input for a Stored procedure..
what i want is to insert data into another table with TVP data as one column and second column from another table that corresponds to TVP data ALTER PROCEDURE [dbo].[RHLeaveEmployee] @rhdays [RHHolidayID] readonly, @empid int AS BEGIN DECLARE @RHDaysList TABLE ( rhdays int,rhid int) INSERT INTO @RHDaysList (rhdays,rhid) SELECT RD.RHName,RH.RHID FROM @rhdays RD JOIN RHHoliday RH ON RD.ID = RH.RHID DELETE FROM RHXrefHoliday WHERE EmployeeID=@empid INSERT INTO RHXrefHoliday (EmployeeID,RHHoliday) SELECT @empid,RHName FROM @rhdays END
HEre @rhdays is TVP. i want to insert into temporary table @RHdaysList with one column as data in TVP and second column taken from another table RHHoliday using condition @rhdays.id=RHHoliday.ID |
|