Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 21st, 2005, 10:25 AM
Registered User
Join Date: Apr 2005
Location: Bloomfield Hills, MI, USA.
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,
Reply With Quote
  #2 (permalink)  
Old July 22nd, 2005, 06:47 PM
Friend of Wrox
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
  #3 (permalink)  
Old July 23rd, 2005, 06:58 PM
SQLScott's Avatar
Wrox Author
Join Date: Dec 2004
Location: Wellington, FL , USA.
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.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 05:42 AM.

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