Listing 1: Script That Creates and Populates a Large Copy of the Orders Table
USE Northwind
GO
DROP TABLE NewOrders
GO

SELECT IDENTITY(int) as Number, CONVERT(varchar(6), OrderID) as OrderID, CustomerID, 
EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress, 
ShipCity, ShipRegion, ShipPostalCode, ShipCountry
INTO NewOrders
FROM Orders
GO

INSERT INTO NewOrders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, 
ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry)
SELECT CONVERT(char(5),OrderID)+'1', CustomerID, EmployeeID, OrderDate, RequiredDate, 
ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, 
ShipCountry
FROM Orders
GO

INSERT INTO NewOrders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, 
ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry)
SELECT CONVERT(char(5),OrderID)+'2', CustomerID, EmployeeID, OrderDate, RequiredDate, 
ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, 
ShipCountry
FROM Orders
GO

INSERT INTO NewOrders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, 
ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry)
SELECT CONVERT(char(5),OrderID)+'3', CustomerID, EmployeeID, OrderDate, RequiredDate, 
ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, 
ShipCountry
FROM Orders
GO

INSERT INTO NewOrders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, 
ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry)
SELECT CONVERT(char(5),OrderID)+'4', CustomerID, EmployeeID, OrderDate, RequiredDate, 
ShippedDate, ShipVia, Freight, ShipName, ShipAddress, ShipCity, ShipRegion, ShipPostalCode, 
ShipCountry
FROM Orders
GO

SELECT count(*)  FROM NewOrders
GO

CREATE UNIQUE INDEX Number_index ON NewOrders(Number)
CREATE UNIQUE INDEX ID_index ON NewOrders(OrderID)
GO