OK, I figured it out pretty much. So now I have this:

CREATE TABLE #tempduplicatedata
(
Code NVARCHAR(20)
)


--Identify and save dup data into temp table
INSERT INTO #tempduplicatedata
SELECT Code FROM Codes
GROUP BY Code
HAVING COUNT(Code) > 1

--Confirm number of dup rows
SELECT @@ROWCOUNT AS 'Number of Duplicate Rows'

--Delete dup from original table
DELETE FROM Codes
FROM Codes
INNER JOIN #tempduplicatedata
ON  Codes.Code= #tempduplicatedata.Code

--Insert the delete data back
INSERT INTO Codes
SELECT Code FROM #tempduplicatedata

--Check for dup data.
SELECT Code FROM Codes
GROUP BY Code
HAVING COUNT(Code) > 1

--Check table
SELECT Code FROM Codes

--Drop temp table
DROP TABLE #tempduplicatedata
 But I am getting the error

Insert Error: Column name or number of supplied values does not match table
definition.

So this tells me that there is a problem with an insert, but not sure which
one. Any SQL Guru's out there that can spot the problem?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268338
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to