Question : how to write a cursor to loop through the records of one table and insert them into another table?

hi,
I am using SQL Server 2005.
I have 2 tables named 'tmpusers' and 'users'
Could you please tell me how to write a cursor to loop through the records of tmpusers and insert them into users table.
I appreciate if you could give me a solution!
Thanks!

Answer : how to write a cursor to loop through the records of one table and insert them into another table?

still, do NOT use cursors
1:
2:
3:
INSERT INTO users (col1, col2, col3, col4, col5, col6)
  SELECT col1, col2, 1, 2312, 'abc', NULL
   FROM tmpusers
Open in New Window Select All
Random Solutions  
 
programming4us programming4us