现在有一个表employee表,字段empNo,empNameempNo empName
1     张三
2     李四新建一个表test表,字段classNo,empNo,empNameclassNo    empNo    empNameinsert into 语句
insert into test (empNo,empName)
select * from employee问题:上面insert into语句只是添加了empNo,empName,我想insert 3个字段。
insert into test (classNo,empNo,empName)
classNo='001'
select * from employee
请修改上面语句........
我期望insert 进到test结果是
 
classNo     empNo     empName
1           1         张三
1           2         李四

解决方案 »

  1.   

    我期望insert 进到test 结果是
    classNo     empno      empName
    001         1          张三
    001         1          李四
      

  2.   

    insert into test (classNo,empNo,empName) 
    select '001' ,empNo,empName from employee 
      

  3.   

    insert into test (classNo,empNo,empName) 
    select (1,empNo,empName) from employee 
      

  4.   


    insert into test (classNo,empNo,empName) 
    select '1',* from employee
      

  5.   

    insert into test (classNo,empNo,empName) 
    select 1,empNo,empName from employee 
      

  6.   

    insert into test (classNo, empNo,empName) select 1, empNo,empName from employee 
      

  7.   

    insert into test (classNo,empNo,empName) 
    SELECT
     RIGHT('0000'+LTRIM(empNo),3)
    ,RIGHT('0000'+LTRIM(empNo),3),
    empName 
    FROM employee
    你的字段得是字符型
      

  8.   

    insert into test(classNo,empNo,empName)
    select '1',empNo,empName from employee 这样?
      

  9.   

    insert into test (classNo,empNo,empName) select '001' ,empNo,empName from employee
      

  10.   

    insert into test (classNo,empNo,empName) 
    SELECT
     RIGHT('00001',3)
    ,RIGHT('0000'+LTRIM(empNo),3),
    empName 
    FROM employee
      

  11.   

    insert into test(classNo,empNo,empName) 
    select '1',* from employee单纯的
      

  12.   


    insert into test (classNo,empNo,empName) 
    select '001' ,empNo,empName from employee