Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 HOW TO MOVE SPECIFIC RECORDS

Author  Topic 

cutepraba
Yak Posting Veteran

53 Posts

Posted - 2008-10-02 : 13:14:42
How to move some specific records to new table. I have 5 lacs rows of data. I want to move some rows dated as 2008, 2007 and 2006 to the respective table.

[jobdate] [smalldatetime]

I know how to do with VB coding. Here to know how to with MSSQL.

____________
Praba

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-02 : 13:26:44
You can use Export/Import wizard. and put your query over there
like : select * from your table where datecolumn>= '2006' and datecolumn <= '2008'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-03 : 02:13:10
or in Query Analyser

insert into target_table(columns)
select columns from source_table
where jobdate>='20060101' and <'20090101'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-03 : 02:15:22
quote:
Originally posted by madhivanan

or in Query Analyser

insert into target_table(columns)
select columns from source_table
where jobdate>='20060101' and jobdate<'20090101'


Madhivanan

Failing to plan is Planning to fail

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-03 : 02:54:14
quote:
Originally posted by visakh16

quote:
Originally posted by madhivanan

or in Query Analyser

insert into target_table(columns)
select columns from source_table
where jobdate>='20060101' and jobdate<'20090101'


Madhivanan

Failing to plan is Planning to fail




Thanks

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-03 : 03:10:16
quote:
Originally posted by madhivanan

quote:
Originally posted by visakh16

quote:
Originally posted by madhivanan

or in Query Analyser

insert into target_table(columns)
select columns from source_table
where jobdate>='20060101' and jobdate<'20090101'


Madhivanan

Failing to plan is Planning to fail




Thanks

Madhivanan

Failing to plan is Planning to fail


welcome Madhi
Go to Top of Page

cutepraba
Yak Posting Veteran

53 Posts

Posted - 2008-10-03 : 03:39:58
quote:
Originally posted by visakh16

quote:
Originally posted by madhivanan

quote:
Originally posted by visakh16

quote:
Originally posted by madhivanan

or in Query Analyser

insert into target_table(columns)
select columns from source_table
where jobdate>='20060101' and jobdate<'20090101'


Madhivanan

Failing to plan is Planning to fail




Thanks

Madhivanan

Failing to plan is Planning to fail


welcome Madhi



Thanks

____________
Praba
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-03 : 04:04:28
welcome
Go to Top of Page
   

- Advertisement -