0

I need to insert a new row into the claim table. I have tried many other ways but non of them work. What I have now is

 INSERT INTO claimant_type
    SELECT ('3' 
            , col1
            , '18'
            , 'ility'
            , col4
            , col5
            , col6)
    FROM claim
    WHERE col4 = '8'

When I execute this script, it said ---- Incorrect syntax near ','. which is '3' or col1.

1
  • @DineshReddy: "... it said ---- Incorrect syntax near ','. which is '3' or col1." Commented Sep 29, 2014 at 14:31

1 Answer 1

3

The only obvious problem is the parentheses. You don't want to put them around a select list:

INSERT INTO claimant_type
    SELECT '3' 
            , col1
            , '18'
            , 'ility'
            , col4
            , col5
            , col6
    FROM claim
    WHERE col4 = '8';

I would also recommend that you explicitly list the columns when using insert.

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.