July 22, 2008 at 11:36 pm
How to insert the contents of a table into an empty table.
I use the following syntax but the order has been changed.
The order is not proper as tableX.
insert into tableX
select date, col1, col2, col3, col4, total
from tableY
July 22, 2008 at 11:53 pm
add the column name in insert statements...
insert into tableX (date, col1, col2, col3, col4, total)
select date, col1, col2, col3, col4, total
from tableY
hope it will help you..
Cheers!
Sandy.
--
July 22, 2008 at 11:59 pm
Thanks Sandy. It works.
July 23, 2008 at 12:03 am
One more thing, the total column shows NULL values as
tableX has more columns then tableY.
July 23, 2008 at 12:07 am
Means???
--
July 23, 2008 at 12:12 am
insert into tableX (date, col1, col2, col3, col4, total)
select date, col1, col2, col3, col4, total
from tableY
tableX :
date, col1, col2, col3, col4, col5, col6, total
tableY :
date, col1, col2, col3, col4, total
the total column of tableX shows NULL values after executing the statement.
July 23, 2008 at 12:19 am
Sorry Sandy, it works properly. The total column has been changed with NULL values after i have executed a stored procedure which add a new row.
July 23, 2008 at 12:22 am
if your TableY-Total columns contains null or no values then only TableX Total column will contain the Null value...
then whats wrong with that...??
Cheers!
Sandy..
--
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply