inserting data using union
-
Hi, I need to handle missing select values programattically. this is what i have insert into A(id, name, age, value, DOB) select 1,'Max','21','a','100928' union select 2,'x','100948' union select 3,'Rex','32','b','100928' union select 4,'xx','100938' union select 5 'Fed','24','xx','100928' all my insert statement are stripped off via regex. the structure of insert statement is as show above. but at times it may miss "name" and "age" and it gives me error something like All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions now those insert scripts are quite bulky. sometime 100MB I would like to automatically handle missing name and age. I am not sure how could i do that? could you please give me some idea?
-
Hi, I need to handle missing select values programattically. this is what i have insert into A(id, name, age, value, DOB) select 1,'Max','21','a','100928' union select 2,'x','100948' union select 3,'Rex','32','b','100928' union select 4,'xx','100938' union select 5 'Fed','24','xx','100928' all my insert statement are stripped off via regex. the structure of insert statement is as show above. but at times it may miss "name" and "age" and it gives me error something like All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions now those insert scripts are quite bulky. sometime 100MB I would like to automatically handle missing name and age. I am not sure how could i do that? could you please give me some idea?
-
how do i pass null value without modifying below block of query select 1,'Max','21','a','100928' union select 2,'x','100948' union select 3,'Rex','32','b','100928' union select 4,'xx','100938' union select 5 'Fed','24','xx','100928' Lets just assume above text is a read only text.
-
how do i pass null value without modifying below block of query select 1,'Max','21','a','100928' union select 2,'x','100948' union select 3,'Rex','32','b','100928' union select 4,'xx','100938' union select 5 'Fed','24','xx','100928' Lets just assume above text is a read only text.
If you don't change the query, the insert will not work. The query should look like this:
select 1,'Max','21','a','100928' union
select 2, Null, Null,'x','100948' union
select 3,'Rex','32','b','100928' union
select 4, Null, Null,'xx','100938' union
select 5 'Fed','24','xx','100928'Wout Louwers
-
Hi, I need to handle missing select values programattically. this is what i have insert into A(id, name, age, value, DOB) select 1,'Max','21','a','100928' union select 2,'x','100948' union select 3,'Rex','32','b','100928' union select 4,'xx','100938' union select 5 'Fed','24','xx','100928' all my insert statement are stripped off via regex. the structure of insert statement is as show above. but at times it may miss "name" and "age" and it gives me error something like All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions now those insert scripts are quite bulky. sometime 100MB I would like to automatically handle missing name and age. I am not sure how could i do that? could you please give me some idea?