Combine INSERT and SELECT
Posted on 2003-11-18
how do I combine the following 2 statements?
INSERT INTO JL_MACHINE(ServiceTag, DateModified, PCName)
VALUES ('2G40T0J', '18/11/2003 13:52:19', 'LSPC166')
INSERT INTO JL_MACHINE(STAFF) SELECT DIWOR from lawsoft.dbo.STAFF where EARNERNAME = 'john smith'
I tried to put the select from the 2nd statement into a subquery in the VALUES section of the 1st statement, but this will not work giving an error saying "you cannot use subqueries in this context". I am using MS SQL server 2000.
Any help much appreciated.