May 27, 2009 at 4:37 pm
Hi guys
I need to update my main table with the current quarter.
The two tables have got exactly same columns.
I can achieve it using union all but then I have to create a different table which contains all these figures.
Could you guys suggest me a query wherein I just have to update my main table with the new rows?
Thanks
May 27, 2009 at 4:41 pm
If you have TableA, and TableB - do you want to UPDATE existing rows in TableA with data from TableB, or INSERT new Rows from TableB to TableA, or (as could be the case) UPDATE where an equivalent row exists and INSERT where no equivalent row exists.
May 27, 2009 at 4:42 pm
Hi there,
you need an INSERT with a SELECT clause.
May 27, 2009 at 5:23 pm
Hi Tim
Basically I want to insert all rows from table B to table A
May 27, 2009 at 5:29 pm
Nuts (5/27/2009)
Hi TimBasically I want to insert all rows from table B to table A
Okay..... try this:
insert into TableA
select * from TableB
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
May 27, 2009 at 5:32 pm
Thanks Guys
It works fine
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply