0

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.

1 Answer 1

3

You have a syntax error, do not put two SELECT in there :

INSERT INTO testtable (value1,value2) 
SELECT 123, [title] 
FROM [dbo].[images];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.