Connecting Tech Pros Worldwide Forums | Help | Site Map

Sql insert cursor

Newbie
 
Join Date: Apr 2009
Location: Okinawa
Posts: 7
#1: May 12 '09
Here is my situation that I am presenting.

I have a table "WebOrders" that is located in a database called SC and I want to insert the data into another table called CustomerOrder located in a database called SMS. The WebOrders must be inserted into the SMS.CustomerOrder table but incremented starting by the last entry in a column called Order_No. Order_No is in the following format GSA7667 NVARCHAR(10). How can I do this with a cursor?

TIA -Gabe

iburyak's Avatar
Expert
 
Join Date: Nov 2006
Posts: 1,017
#2: May 12 '09

re: Sql insert cursor


Can you order by date in descending order instead of ID??
Try to use cursors as little as possible you can insert whole table in one shot why would you use cursor for that?
Newbie
 
Join Date: Apr 2009
Location: Okinawa
Posts: 7
#3: May 13 '09

re: Sql insert cursor


Iburyak, I think I got a solution. Thank you for replying!

-Gabe
Reply


Similar Microsoft SQL Server bytes