Wrox Programmer Forums
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 21st, 2005, 10:25 AM
Registered User
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default DISTINCT ntext Values

I am trying to run a query to one of two delete duplicates records. The process I normally use is use
1) SELECT DISTINCT from the table into a second table
2) Delete all duplicate values in original table
3) Copy the disctinct values from the second table back into the original table

Unfortunately, this time, my table has ntext fields in it. SELECT DISTINCT does not work with ntext fields.

Does anyone have an alternative solution?

Thank you,
Old July 22nd, 2005, 06:47 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Add another column of type int and enable its IDENTITY attribute, to the same table and by this you would get unique values, and that should be easier to delete the duplicate rows.

- Vijay G
Strive for Perfection
Old July 23rd, 2005, 06:58 PM
SQLScott's Avatar
Wrox Author
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts

Fleming, are you really trying to delete duplicate rows or are you looking to identify each row distinctly? If you are need to add uniqueness to each row (identify each row distinctly), then Vijay's response will work. If not and you are truly trying to delete duplicate rows, I think there is an easier way to do this. As you found out, you can't SELECT DISTINCT on a ntext field. Is there another field you could SELECT DISTINCT on? Depending on your answer, it might be possible to do this in a single statement without the hassle of your 3 steps above.

Similar Threads
Thread Thread Starter Forum Replies Last Post
getting distinct values from attribute markus2000 XSLT 1 June 13th, 2006 03:06 AM
count distinct values Chris Cash XSLT 3 June 8th, 2006 04:55 PM
distinct-values in Javascript Jan1 XML 2 October 10th, 2005 04:56 AM
Distinct values of data arnabghosh Access 18 September 13th, 2005 05:41 PM
Regarding Inserting values to ntext field Hari_Word ADO.NET 1 August 31st, 2004 05:15 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.