Reputation: 785
I'm trying to insert lots of rows into a 2 column table at once where one of the values remains constant. This is what I have tried: -
insert into testtable (value1,value2)
select
123,
( SELECT [title] FROM [dbo].[images])
This gives me the following error:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
I could insert each row one at a time but I was wondering if there is a way I g=could do the whole lot in one go.
Upvotes: 0
Views: 57
Reputation: 6261
You have a syntax error, do not put two SELECT
in there :
INSERT INTO testtable (value1,value2)
SELECT 123, [title]
FROM [dbo].[images];
Upvotes: 3