Insert multiple rows into single column

前端 未结 9 1650
抹茶落季
抹茶落季 2020-12-24 07:29

I\'m new to SQL, (using SQL 2008 R2) and I am having trouble inserting multiple rows into a single column.

I have a table named Data and this is what I

相关标签:
9条回答
  • 2020-12-24 08:02

    Kindly ensure, the other columns are not constrained to accept Not null values, hence while creating columns in table just ignore "Not Null" syntax. eg

    Create Table Table_Name(
                col1 DataType,
                col2 DataType);
    

    You can then insert multiple row values in any of the columns you want to. For instance:

    Insert Into TableName(columnname)
    values
          (x),
          (y),
          (z);
    

    and so on…

    Hope this helps.

    0 讨论(0)
  • 2020-12-24 08:05

    to insert values for a particular column with other columns remain same:-

    INSERT INTO `table_name`(col1,col2,col3)
       VALUES (1,'val1',0),(1,'val2',0),(1,'val3',0)
    
    0 讨论(0)
  • 2020-12-24 08:10

    I believe this should work for inserting multiple rows:

    INSERT INTO Data ( Col1 ) VALUES
    ('Hello'), ('World'),...
    
    0 讨论(0)
提交回复
热议问题