现在我要往一张表里面插入一些数据,我自己写了一条语句,其实就是除LOB这列外,全部都拷贝其他行的,不知对不对?还有,原来的数据库字段中有三个'create','open','system',这些会不会和sql有冲突?insert into tblprospectstatus (Instance, LOB, Status, descripton, Scale, SeqNo, Pending, Submitted, booked, lost, othersystem, create, open, system, valid, show)
values (select Instance, '250', Status, descripton, Scale, SeqNo, 
Pending, Submitted, booked, lost, othersystem, create, open, system, valid, show
from tbltblprospectstatus where lob='210')

解决方案 »

  1.   

    但是报错了Server: Msg 156, Level 15, State 1, Line 2
    Incorrect syntax near the keyword 'create'.
    Server: Msg 156, Level 15, State 1, Line 4
    Incorrect syntax near the keyword 'create'.
      

  2.   

    insert into tblprospectstatus (Instance, LOB, Status, descripton, Scale, SeqNo, Pending, Submitted, 
    booked, lost, othersystem, [create, [open], [system], valid, show)
    values select Instance, '250', Status, descripton, Scale, SeqNo, 
    Pending, Submitted, booked, lost, othersystem, [create], [open], [system], valid, show
    from tbltblprospectstatus where lob='210'还有报错
    Server: Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'select'.
      

  3.   

    insert into tblprospectstatus (Instance, LOB, Status, descripton, Scale, SeqNo, Pending, Submitted, 
    booked, lost, othersystem, [create], [open], [system], valid, show)
    values select Instance, '250', Status, descripton, Scale, SeqNo, 
    Pending, Submitted, booked, lost, othersystem, [create], [open], [system], valid, show
    from tbltblprospectstatus where lob='210'为什么还报错阿,急啊,这么简单的问题啊,拿分的好机会啊
    Server: Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'select'.
      

  4.   

    insert into t 
     select * from t1 insert into t( col1 . col2 , ...)
            values( 1 , 2 ,....)
    --
    列的个数都需要 匹配