January 2, 2007 at 8:58 am
Hope everyone had a great holiday!
I was wondering if there is away to pull in a value of the current record if the query looks like this?
Declare
@partno1 char(25) --@partno char(25),
Set @partno1 = 'FPM 413Z5000-94701-'
--Set @partno = (Select fpartno from inrtgs Where fpartno like @partno1)
INSERT INTO [M2MDATA01].[dbo].[inrtgs]
([fpartno],[fcpartrev],[foperno],[fchngrates],[fcstddesc],[felpstime]
,[ffixcost],[flschedule],[fmovetime],[foperqty],[fothrcost],[fpro_id]
,[fsetuptime],[fsubcost],[fulabcost],[fuovrhdcos],[fuprodtime],[fusubcost]
,[fllotreqd],[fccharcode],[fopermemo],[fac],[fcudrev],[fndbrmod]
,[fnsimulops],[fyield],[fsetyield])
VALUES
("I want this value to be the fpartno of the current record"
,'000'
,'35'
,'Y'
,' '
,0
,0
,1
,0
,1
,0
,'QA '
,0
,0
,0
,0
,0.1
,0
,0
,' '
,''
,'Default '
,'000'
,0
,1
,100
,0)
WHERE (fpartno LIKE rtrim(@partno1) + '%'
January 2, 2007 at 9:11 am
Not this?
insert into ....
values (@partno, '00', ...
)
January 2, 2007 at 12:26 pm
I think you are asking for
INSERT INTO table1 ( columns) SELECT coulmns FROM table 2
WHERE fpartno LIKE rtrim(@partno1) + '%'
cheers
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply