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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 move record from table to table

Author  Topic 

doublek
Starting Member

8 Posts

Posted - 2006-02-19 : 08:08:26
hi, i have 2 question here hope someone can help me.

1) INSERT INTO table2 (col1, col2, col3....)
SELECT col1,col2, col3
FROM table1
WHERE someting.....

2) by refer to (1), how to move 1000 or more rocord from table1 to table2 ?. how to i store the 1000 records from table1 and insert it into table2 ?. is there any solution to this problem.

anyone help appreciate! thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-19 : 09:01:24
What is your 1st question ?

"2) by refer to (1), how to move 1000 or more rocord from table1 to table2 ?. how to i store the 1000 records from table1 and insert it into table2 ?. is there any solution to this problem."
You already have the answer to this question. Which is the statement you posted under 1).

----------------------------------
'KH'

Time is always against us
Go to Top of Page

doublek
Starting Member

8 Posts

Posted - 2006-02-19 : 09:23:00
sorry!

INSERT INTO table2 (col1, col2, col3....)
SELECT col1,col2, col3
FROM table1
WHERE someting.....

by refer to above, how to move 1000 or more rocord from table1 to table2 ?. how to i store the 1000 records from table1 and insert it into table2 ?. is there any solution to this problem.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-19 : 09:35:40
"move"
You mean insert to table2 and delete from table1 ?

-- This will insert records into table2 from table1
INSERT INTO table2 (col1, col2, col3....)
SELECT col1,col2, col3
FROM table1
WHERE someting.....

-- This will delete these records from table1
DELETE table1
WHERE someting.....



----------------------------------
'KH'

Time is always against us
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-20 : 01:29:24
If you want to store only 1000 records then you should use Top 1000 with Order by Clause. Why do you want to do this?

Madhivanan

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

- Advertisement -