Thursday, March 29, 2012

Duplicate Text data

Anyone have a method for identifiying dupes in a text field?
coromokes wrote:
> Anyone have a method for identifiying dupes in a text field?
By dupes, you mean the existence of the same text value in more than one
row? If so, you can group on the text column and use a having clause to
test for dupes.
You'll need to convert to a varchar or nvarchar data type first, which
means you'll only get access to teh first 4,000 or 8,0000 characters for
the test. But maybe that's good enough.
Select CAST(TextDataCol as VARCHAR(8000))
From TableName
Group By CAST(TextDataCol as VARCHAR(8000))
Having COUNT(*) > 1
David Gugick
Imceda Software
www.imceda.com
sql

No comments:

Post a Comment