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 / madhu sudhan g

Hiii

DELETE T1
OUTPUT DELETED.COLUMN1,DELETED.COLUMN2...
INTO T2
DELETE T2
OUTPUT DELETED.COLUMN1,DELETED.COLUMN2...
INTO T3
DELETE T3
OUTPUT DELETED.COLUMN1,DELETED.COLUMN2...
INTO T4

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I create a stored procedure in dbml?

687


what are cursors? : Sql server database administration

719


What happens when converting big values to integers?

729


What is a result set object returned by odbc_exec()?

725


How to modify an existing stored procedure in ms sql server?

738






How to store and query spatial data?

733


What is xdr?

755


You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?

835


What is the use of commit?

735


What is the difference between varchar and varchar types?

744


What are the types of user defined functions in sql server?

718


What are the basic functions for master, msdb, model, tempdb databases?

784


How to optimize stored procedure optimization?

671


How do indexes help, types?

718


How to add the custom code in Report?

112