5 pts.
 Insert for a table
I have a table which consists of lakhs of records and itemnumber is one of the column.I want to insert those records into the same table but with different new itemnumber from another table.what is the best way of doing it?

Software/Hardware used:
ASKED: August 6, 2008  5:03 AM
UPDATED: August 6, 2008  7:59 PM

Answer Wiki:
Does the other table have the new item numbers? If so you can simply use an insert statement to copy the data. <pre>INSERT INTO ItemTable (ItemId, ItemName) SELECT ItemId, ItemName FROM OtherTable</pre> Is the ItemId column an IDENTITY Column? If so it will assign new numbers for you automatically. <pre>INSERT INTO ItemTable (ItemName) SELECT ItemName FROM OtherTable</pre>
Last Wiki Answer Submitted:  August 6, 2008  7:59 pm  by  Denny Cherry   64,520 pts.
All Answer Wiki Contributors:  Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.

 64,520 pts.