J C
asked on
SQL problem with insert
I am trying to use the sql command below to duplicate subcategories from product list 1 to product list 2. The select statement returns the expected results but when I try to use it as a subquery it fails. Can anyone tell me how I can make this work?
INSERT INTO slprodsubcat
(prodlist, catcode, subcatcode, subcatdesc)
SELECT '2' as prodlist, catcode, subcatcode, subcatdesc
FROM slprodsubcat
WHERE prodlist = '1'
What happens when it fails? And do you have the code for you subquery?
ASKER
I included the entire command I am running. I am referring to the select statement as the subquery.
Here is the error:
PSC-init
Msg 512, Level 16, State 1, Procedure _TI_slprodsubcat, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
Here is the error:
PSC-init
Msg 512, Level 16, State 1, Procedure _TI_slprodsubcat, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.