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
 INSERT problem

Author  Topic 

chxxangie
Starting Member

16 Posts

Posted - 2008-05-22 : 19:28:54
INSERT INTO pvm(pvm_div,pvm_vndno,pvm_itemno,pvm_dts, pvm_ci,.....)
values( ........ )


the values part....for the first three column(pvm_div,pvm_vndno,pvm_itemno), i need to parse the program variable to it. or something like values('01','aaa','qqq')..........
but for the pvm_dts, pvm_ci,... these column, i need to use subquery (select form .... where.....) to get the data from other table.
is there anyway to combine it? or any way can perform the same function?

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-05-22 : 19:46:02

INSERT INTO pvm(pvm_div,pvm_vndno,pvm_itemno,pvm_dts, pvm_ci,.....)
select (col1, col2, '01, 'aaa', 'qqq', col3...)
from ....
where ...

Be One with the Optimizer
TG
Go to Top of Page

chxxangie
Starting Member

16 Posts

Posted - 2008-05-22 : 21:00:48
thank you very much...now i know how to do it...i'd learnt a lesson from you. :)
Go to Top of Page
   

- Advertisement -