July 4, 2009 at 8:59 am
Hi Guru's
Is there any chance to move the particular rows from one table to other...?if yes..how do we do that..?
Thanx in advance..
July 4, 2009 at 9:13 am
if you're making a new table:
select *
into DestinationTable
from SourceTable
where Expression
If the destination table already exists:
insert into DestinationTable
select *
from SourceTable
where Expression
where:
DestinationTable is the new table you want to move the records into.
SourceTable is the table you are coping the rows from.
Expression is the list of Field=Value for the rows that you want to copy.
If you then want to delete the rows from the source table, you will need to follow this up with:
delete from SourceTable where Expression
All of this information is available by reading Books Online (BOL), the SQL Server Help System. You can access it by pressing the {F1} function key while in SQL Server Management Studio (SSMS). Just highlight the word "select" in a query window, and press {F1}.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
July 4, 2009 at 10:19 pm
dineshbornleo (7/4/2009)
Hi Guru'sIs there any chance to move the particular rows from one table to other...?if yes..how do we do that..?
Thanx in advance..
A better question would be, why do you want to do this? Are you trying to archive rows or what?
--Jeff Moden
Change is inevitable... Change for the better is not.
July 6, 2009 at 9:10 am
Jeff Moden (7/4/2009)
dineshbornleo (7/4/2009)
Hi Guru'sIs there any chance to move the particular rows from one table to other...?if yes..how do we do that..?
Thanx in advance..
A better question would be, why do you want to do this? Are you trying to archive rows or what?
+1 ..... More information will usually yield you a better answer.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply