Reply to comment

sql insert using a select and a static value

This is just for reference. I forgot the syntax already twice. The insert query does not work if you use parenthesis.


create table test ( a int , b int) ;
create table test1 ( c int) ;
insert into test1 values 1;
insert into test1 values 2;
insert into test1 values 3;
insert into test1 values 4;

insert into test (a,b) select c,0 from test1;
select * from test;
1|0
2|0
4|0
3|0

Average: 1.6 (10 votes)

Reply

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
B
9
W
L
5
m
Enter the code without spaces and pay attention to upper/lower case.