insert into tablename values('1','2','3',default)其中第四个字段插入的是default值
但执行insert into tablesname select a,b,c,default from tablesname1 就报错
我如何使用insert into tablesname select...的方式来插入default值?
但执行insert into tablesname select a,b,c,default from tablesname1 就报错
我如何使用insert into tablesname select...的方式来插入default值?
我是需要使用insert into tablesname select a,b,c,default from tablesname1 语句来插入default值
第4个字段用default不行
1、insert into tablename(字段1,字段2,字段3) value(1,2,3);
2、insert into tablename values(1,2,3,NULL);
你的写法有两种:
如果你说的DEFAULT是一个字符串而不是默认值的话。替换NULL为‘DEFAULT’
1、insert into tablename select 'a','b','c',NULL;
2、1、insert into tablename(字段1,字段2,字段3) select 'a','b','c';
比如有个表(A),有2个字段,a和b,但b字段有个默认值,为‘999’
我用insert into values (1,default)可以把b字段的记录插入为默认值
A B
1 999
但我现在是想先查询另一个表(B),把另一个表B的值插入到这个表(A)
用这条语句:insert into 表(A) select 表B.a,default from 表(B)是无法插入那个default值的
我现在就是想用insert into 表(A) select 表B.a,default from 表(B)这种语句写数据进去,但运行这个语句是报错的
insert into values (1,default)修改为
insert into 表(A) values (1,default)
这样难道不行 吗??????