Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

i have 4 tables.. T1, T2, T3, T4..
these tables have the same structure and they store the
information entered in different years..
T1 stored 2002, T2 stored 2003, T3 stored 2004 and T4 stored
2005..

i want to copy contents in T1 to T2, T2 to T3, T3 to T4 and
T4 to T1..
how do i do that? Temp tables cannot be used..

Answer Posted / deepak

Just copy all data in T1 from T4.

insert into T1 (select * from T4)

Now do this assuming 'dateCol' contains the date:

delete from T4
insert into T4 (select * from T3)
delete from T3
insert into T3 (select * from T2)
delete from T2
insert into T2 (select * from T1 where year(dateCol) = 2002)
delete from T1 where year(dateCol) = 2002

This should move the data around without using temp table.

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of optimization?

1060


can a database be shrunk to 0 bytes, if not, why? : Sql server administration

1311


How many columns can we include on clustered index ?

1060


How do I install sql server?

937


Explain the use of keyword with encryption. Create a store procedure with encryption?

1007


What is snapshot report?

172


What is the preferred way to create a clustered and non-clustered index? Which index should you create first the clustered or non-clustered?

961


Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.

2456


Do I need a report server to run reports in my application?

170


What are three major types of constraints?

1174


What is a Join and explain its types?

1151


What are the joins in sql server? : sql server database administration

1050


Explain what is scheduled job and how to create it?

1026


Which sql server table is used to hold the stored procedure script?

1004


What is the use of tempdb? What values does it hold?

1120