Finding Duplicates Regardless Of Special Characters - Help Plz

Nov 22, 2005

I am trying to move distinct data from one table to another based on two columns regardless of special characters such as : ( ) ; ' " / - _ = >< etc. The two columns that are the defining factors that I need to match as duplicates are Col1 & Col3, the rest I want to get the maximum data from each column for that row (I hope this made sense).

Here is what I have tried, but it does not seem to work:

Code:


select
ID,
Col1,
max(Col2)as Col2,
Col3,
max(Col4)as Col4,
max(Col5)as Col5,
max(Col6)as Col6,
max(Col7)as Col7,
max(Col8)as Col8,
max(Col9)as Col9
where patindex('%[^-:]%',Col1) = 0 AND patindex('%[^-:]%',Col3) = 0
into Newtable
from dbo.CLEANING_bk
group by Col1,Col3



Basically if there are 10 rows of duplicate data based on Col1 & Col3 (regardless of special characters), I want to move the distinct info to a new table with the maximum amount of info from the other columns of the duplicate rows.

If row 3, 4,5, & 6 are all considered duplicate and Row3/Col2 has info in it that row 4 & 5/Col2 does not, I want to combine it with the single row I export to the new table retaining as much information from the rows of the duplicates as possible.

Can anyone help and let me know why my script is not wanting to play nice?

View 14 Replies


ADVERTISEMENT

Finding Special Characters With A SELECT Statement

Mar 12, 1999

Hey Swynkers,

I've got a tricky one. I'm trying to do a SELECT statement to return all of our email fields that include the Newline character, or Char(13). I've tried all of the following with no result:

WHERE Email like "%Char(13)%"
WHERE charindex(Char(13), @Email) > 0
WHERE patindex(@NewLine, @Email) > 0

Any suggestions?

Thanks,

Fenderson

View 3 Replies View Related

Special Characters

Jan 16, 2006

Hi All

I have a database I want to check whether any special characters are entered or not

E.g.

Post
-------

Director
Asst*Director
Ma^nager

I want to see all the entires where special characters like !@#$%^&*()_+ are entered

Plz help

Thanks

View 8 Replies View Related

Special Characters

Mar 10, 2008

Hi,

I an concatenating a string using char(187) as the separator. When I run the command "select char(187)" I get the symbol >>

However, when it writes to a csv file it is showing as an overscore instead.

Is there a known problem with special characters when writing to files?

View 2 Replies View Related

Special Characters

Apr 2, 2008

Our SQL 2005 databases have "SQL_Latin1_General_CP1_CI_AS"
collation settings on the server. One of tables has one column declared as "ntext".
When we try to insert "‚¬" character directly trough insert statement and retrieve it, we're getting right results. When we use web-services to insert data with this character (euro), and retrieving the data back, we're not getting this sign back. We are getting some characters like little squares. If I try to copy and paste them into notepad, I am getting ???
However, when I tried to place them here, I got them right:

‚¬ Å Å¡ Ž ž Å’ Å“ Ÿ

How can we assure visually they are inserted properly?

View 1 Replies View Related

SQL Query For Special Characters

Apr 18, 2007

On the bills that our system generates there is a comments field that users fillout. We have occasional problems with special characters in the text messing up the validation code. Does anyone know of a query that can identify special characters in a text field? Like carriage returns, tabs, etc.?
 Thanks, Dave

View 1 Replies View Related

BCP Issue-Special Characters

Jul 6, 2000

Iam working on sql server 7.0.

I have to bring in data from a text file into the sql server database. I use the BCP utility in pulling the data.

The flat file data contains special characters like ®. This is the registered trade mark symbol. When I bcp the file using the character mode the special characters are automatically changed to «. So If I am going to pull a data like ACRYLON®, after the BCP I get it as ACRYLON«.

Inorder to replace all these I have written a program but since it has to scan every record the time taken is more. Will in be possible to accomodate iun the BCP to pull the data with special characters.

If you have an answer to this please reply soon.

Thanks,

-Rajesh

View 2 Replies View Related

Special Characters - Search In DB

Mar 6, 2001

Hi !

I have an DB in SQL Server 7, and in Portuguese we have special characters like "á","õ",etc. And I want to let the visitor to a site to do a search (written in ASP), and not to need to write the correct way (without the accents). But either he writes or not in the correct way, the results are the same, not necessarly in the same order. Is there a SQL Server mechanism that permits this functionality, without doing a very complicated SELECT (takes a lot of time) or replicating a field in the DB (takes a lot of extra space)...

Thanks !
Filipe Lopes, Lisbon, Portugal.

View 2 Replies View Related

German Special Characters

Apr 13, 2003

I have a problem inserting German special chracters into a MSSql table.

üöäÖ works fine, but ßÜÄ are reduced to "_". I'm using a html form and a php script to enter the data into the database. Any idea why this isn't working? Funny thing is, when I use a german version of the SQL Server it also works without a problem... but I need this to work on ANY mssql server. Any help would be very much appreciated.

Michael

View 6 Replies View Related

Can't Insert Special Characters

Jan 2, 2007

Hi, I'm new here. Happy new year!

Simple question. I can not insert special characters such as ' " ( ) etc. What special escape I need to put in my sql statement?

View 2 Replies View Related

Special Characters In MSSQL.

Mar 7, 2006

Hi,I have a MSSQL Server communicating with an Oracle database through aMSSQL linked server using a MS ODBC connection.If I query the Oracle database through the Oracle ODBC 32Bit Test, theresult is fine:select addrsurname from address where addrnr = 6666;HÅKANSSONIf I do the same query within the SQL Query Analyzer (using the linkedserver), I get:select * from openquery(TESTSW, 'select addrsurname from address whereaddrnr = 6666');H?KANSSONI have tried to both check and uncheck the Automatic ANSI to OEMconversion, but the result remains the same.Does anyone know what to do to make the result display the specialcharacters in SQL Query Analyzer?Thanks,Kenneth

View 4 Replies View Related

Treatment Of Special Characters

Jul 20, 2005

Hi,This is a generic question, but for arguement's sake, let's say, myenvironment is SQL Server 2000.It seems that setting quoted_identifier off is the best way toaccomodate all sort of data input/update especially for data set thatcontains special characters like single quote as in O'Brien, otherfunky stuff like %^$*@#(!).However, this option won't help with a situation like data value of5'9",and let's say, we really can't predicate if this type of value will beused for ColA or ColB or ColC ...Examplecreate table #tmp (col1 varchar(30));set quoted_identifier off;insert into #tmp values("O'Brien's barking dog'");-- successinsert into #tmp values("O'book has funky (%^$*7) stuff");-- successinsert into #tmp values("John said "funky is OK" in his speech");-- failedGlobaly search and replace the double quotes before insert/update isjust too "expensive", not a good option.Now, if we can set a custom quoted_identifier, we can solve the aboveproblem easily, for instance,if MS SQL Server permits/acceptsset quoted_identier = '//$$';theninsert into #tmp values(//$$John said "funky is OK" in hisspeech//$$);(or the like)would succeedAny other thoughts/ideas? Thanks.Quote "Never stop thinking even though at times it may produce waste,which we all do, btw :) "

View 4 Replies View Related

Special Characters In TextBox

Jun 14, 2007

Currently I have got a report where I want to insert special characters (like @, !, ?) at the end of a String which will be displayed in a textbox of the report. Wenn I insert the String value "test!?" the report will return this value "!?test".



Does somebody know what is going wrong?

View 1 Replies View Related

Spaces And Special Characters

Aug 31, 2007

Good day
I've looked for information about this but to no avail. Essentially why does Reporting Services not support spaces and special characters in a Field Name?
I know that SQL supports spaces utilizing [] brackets e.g. [Field Name With Spaces]. So how come RS doesn't?
Thanks

View 1 Replies View Related

Special Characters In Reports

Jan 5, 2007

I am trying to display data that has trademark and copyright symbols. Reporting services does not display them in the standard format. Anyhelp is appreciated on how to get this done.

View 3 Replies View Related

Storing Special Characters For Use In Email

Feb 19, 2003

I am trying to store the content (body) of an email message that I want to create in a column SQL 2000. I need to know how I can store the special characters (carriage returns, bullets, etc) so that when I select them from the database to reform the email the correct formatting appears.

Any suggestions?

View 1 Replies View Related

Insert Special Characters In Database

Sep 19, 2006

I am writing a web application and everytime I attempt to insert some special characters in the database I get errors. Is there a way around this?

View 5 Replies View Related

Search By Ignoring Special Characters

Dec 14, 2011

In our schools we have a number of East-European, Turkish, Scandinavian, ... students. Their names contain "special" characters, like Ö, Ü, Ø, ... Our users want to be able to search for student names without having to enter those special characters. Most often they don't know the exact spelling of the names and they get "no match found" messages as a result.

They want to have persons with the name Ösgür, Osgueld, ... in the result set after entering "osgu" in the search field.

What is the best way to do this? I was thinking about using another collation near the LIKE, but I don't know if that would work and how it should be done. The Database collation is Latin1_General_CI_AS.

View 4 Replies View Related

Find All Special Characters In Table

Jan 23, 2015

I would like to find all Special Characters in a table. I am currently using the code below. Not sure if this gets all of them.

select top 50 *
from [dbo].[SV20150122]
where street LIKE '%[^0-9a-zA-Z @.-]%'

View 1 Replies View Related

Special Characters In Input File

Oct 19, 2001

I am trying to import a file to a db table from a mainframe system. When I look at it on the PC has some special characters in it. They look like nulls and or tabs. When I try to define the fields in DTS, I only see up to the first special character.
I tried to write a quick VB program to strip them out, but when VB is reading the file they get stripped out before I see them in the program.
Any help would be greatly appreciated.


Ron Grzywacz

View 1 Replies View Related

Transact SQL :: How To Get All Characters Before Special Character

Jul 21, 2015

I would like to know how can i only get the characters before the special character?

For example if the mail id is The.Champ123@gmail.com i need to extract The.Champ123 and if the mail id is TheChamp@gmail.com I need to get TheChamp.So basically i would like to get the characters from the string before '@' character.

View 14 Replies View Related

Search Values With Special Characters

Sep 8, 2006

In my database, I have records stored as "Scooter, gears, hard hat" When the user enters in the textbox "Scooter gears hat" it does not return any records. How can I tell the DB to ignore the characters in the column and search for the full text only and return all values?

Thanks

View 3 Replies View Related

T-SQL Special Characters (bold Font)

Jan 19, 2008



Hi,

I'm trying to figure out how to insert a special character that will make the values in the column BOLD when I use that table as reference in my Word Mailmerge. For starters, I was able to insert char(10) as carriage return, so when I use the values from that table in my mailmerge, the char(10) is effective, meaning, the carriage returrn is working, but how about making the font bold? Please help.

Example is:

insert into table(customer_address)
values ("123 hayworth drive" + char(10) + "new land grove" + char(10) + "chicago" + char(10))

This value when used in a Word Mailmerge, will be displayed as:
123 hayworth drive
new land grove
chicago

Now, how do I insert a special character for bold font?

View 1 Replies View Related

Special Characters In A Dropdown List

Nov 2, 2006

I have a web form that needs to be bilingual. It contains several dropdown lists. The "text" and "value" for each item in the dropdown list is retrieved from a database. The logic reads the database and then populates the various dropdowns with logic such as:

dim newItem as new ListItem(textString, valueString)

theDropDown.items.add(newItem)

The problem that I am having occurs when the textString needs to contains special characters such as accented vowels or an "n" with a tilde. I have tried populating the database with HTML-formatted strings such as "Avi&oacute;n", hoping that this would display "Avion" with an accute accent over the "o". Unfortunately it displays "Avi&oacute;n".

How do I get dynamically-created dropdowns to display special characters? If the answer is to simply store the special characters directly in the database, then the question becomes how do I get the special characters into the database? I tried to figure out how to write a T-SQL command such as

update tablex set SpanishName = 'Avion' where id=999

but I can't figure out the syntax to insert an accented 'o' into the string.

Thanks.

View 4 Replies View Related

Group BY Issue -Special Characters

Dec 7, 2007

We have a column that contains special characters which are downloaded from DB2 and stored in sql as varchar(4)

The ASCII() function is showing that two of the values are different, yet a simple group by indicates they are the same.


select [LRI_MAINT_KEY], ascii(substring(lri_maint_key,1,1)),ascii(substring(lri_maint_key,2,1)),ascii(substring(lri_maint_key,3,1)),ascii(substring(lri_maint_key,4,1))

FROM [DB2Staging].[dbo].[DB2_LRI_INTERIM_MKEYS]

group by [LRI_MAINT_KEY], ascii(substring(lri_maint_key,1,1)),ascii(substring(lri_maint_key,2,1)),ascii(substring(lri_maint_key,3,1)),ascii(substring(lri_maint_key,4,1))

having count(1) > 1

LRI_MAINT_KEY (No column name) (No column name) (No column name) (No column name)

O  79 3 10 20

OÆ’* 79 3 131 42



select [LRI_MAINT_KEY]

FROM [DB2Staging].[dbo].[DB2_LRI_INTERIM_MKEYS]

group by [LRI_MAINT_KEY]

having count(1) > 1

O

Oë@

O 

OÆ’*



SELECT [LRI_MAINT_KEY]

into #temp_1

FROM [DB2Staging].[dbo].[DB2_LRI_INTERIM_MKEYS]

group by [LRI_MAINT_KEY]

having count(1) > 1



select ascii(substring(lri_maint_key,1,1)),ascii(substring(lri_maint_key,2,1)),ascii(substring(lri_maint_key,3,1)),ascii(substring(lri_maint_key,4,1)) ,*

FROM [DB2Staging].[dbo].[DB2_LRI_INTERIM_MKEYS]

where lri_maint_key in

(

select [LRI_MAINT_KEY] from #temp_1

)

LRI_MAINT_KEY (No column name) (No column name) (No column name) (No column name) LRI_OID

Oë@ 79 1 235 64 9400000010

OË@ 79 1 203 64 9400000083

O 79 0 234 60 940000009F

O 79 0 202 60 9400000119

OÆ’* 79 3 131 42 94000006E0

OÆ’* 79 3 131 42 94000006F5

O  79 3 10 20 9400000884

O  79 3 10 20 9400000885




Are there any know issues using columns with special characters in the group by clause. Let me know.

Thanks

View 5 Replies View Related

Finding Duplicates In SQL

Jul 26, 2002

I have a customer database with the following structure:

Dept ID (int)
Section (varchar)

I need to find only occurrences of a section (eg Admin) where the section name has a record in Dept 1,2 and 3 - only return the result if the record for Admin is associated will these depts.

Example Data:

Dept Section
1 Admin
1 Finance
1 Marketing
2 Admin
2 Sales
2 Marketing
3 Admin
3 Sales
3 Finance

The query would only return 'Admin' since this is the only Section that is represented in Departments 1,2 + 3.

I am not in control of the data design and can't create a bitwise field to achieve this.

tia,
Steve

View 1 Replies View Related

Finding Duplicates

Jul 7, 2004

I am trying to complete an insert from query but the problem is I have duplicates, so I'm getting an error message. So to correct it I am creating a Find Duplicates statement in the Query analyzer but Its not working can someone tell me whats wrong with this statement (by the way I'm in SQL 2000 Server)

thank you

SELECT EmployeeGamingLicense [TM#]AS [TM# Field], Count([TM#])AS NumberOfDups
FROM TERMINATION
GROUP BY [TM#]
HAVING Count([TM#])>1;
GO

View 14 Replies View Related

Finding Duplicates - Is This Right?

May 16, 2007

I've done a search and I THINK I've got my head round this, but I'd be very grateful if someone could reassure me:

SELECT Email FROM List1 WHERE EXISTS (
SELECT Email FROM List2 WHERE List2.Email= List1.Email
) AND List1.Email <> '44'

That will give me every email address from list one that (a) appears in list two, and (b) isn't '44'. Right?

And to find all the emails from List1 that DON'T occur in List2 (and aren't '44'), I just put "NOT" in front of "EXISTS". Right?

Sorry for asking an obvious question but I'm having a real mental block here. :o

View 6 Replies View Related

Finding Duplicates

Jun 5, 2008

how can i find duplicates in my database? i want to find them in the website and expressemail field

View 5 Replies View Related

Finding Duplicates Using More That One Key

Jun 16, 2008

Hi guys,

I was just wondering if any one knows how to find duplicate keys using more than one field. I used the below key to find those people who exists in list1 but don't exists in list2. I realized that the results had some duplicates which was expected but how do I then find all those duplicate people. I know how to do it if there was a primary key present I would have done a count (distinct cardnumber) > 1 and i would have done the select statement like this distinct cardnumber, but how do I do it with more that one key??

View 1 Replies View Related

Finding Duplicates

Jul 20, 2005

I have a company table and I would like to write a query that will return tome any duplicate companies. However, it is a little more complicated thenjust matching on exact company names. I would like it to give me duplicateswhere x number of letters at the beginning of the company name match AND xnumber of letters of the address match AND x number of letters of the citymatch. I will be doing this in batches based on the first letter of thecompany name. So for example I will first process all companies that startwith the letter "A".So for all "A" companies I want to find companies where the first 5 lettersin the company name match and the first 5 characters of the address fieldmatch and the first 5 characters of the city match. THANKS!!!

View 3 Replies View Related

Finding Duplicates?

Oct 9, 2007



I'm trying to find duplicates. Any help will be greatly appreciated! Here's my query:

I'm trying to find only the records where the "Sales_Header_Your_Reference" field is used more then once with a different "Sales Header Document ID" So it looks like this
Sales Header Document ID Sales_Header_Your_Reference
1955718 0002377729
2082721 0002478945
2082728 0002478976
2093598 0002487318
2093599 0002487318
2093601 0002487332
I hope im clear enough, here is my query. I get then listed right, but the count is all wrong, I only want to show the ones , like the one i have highlighted.



Code Block

Select COUNT(Sales_Header_Your_Reference),Tbl_Sales_Header.Sales_Header_Document_Id,Tbl_Sales_Header.Sales_Header_Your_Reference
FROM dbo.Tbl_Sales_Header
INNER JOIN dbo.Tbl_Sales_Invoice_Header
ON dbo.Tbl_Sales_Header.Customer_Bill_Customer_No = dbo.Tbl_Sales_Invoice_Header.Sales_Invoice_Header_Bill_Customer_No AND
dbo.Tbl_Sales_Header.Sales_Header_Order_DateTime = dbo.Tbl_Sales_Invoice_Header.Sales_Invoice_Header_Order_Datetime
WHERE (dbo.Tbl_Sales_Header.Sales_Header_Order_DateTime > CONVERT(DATETIME, '2007-09-15 00:00:00', 102)) AND
(dbo.Tbl_Sales_Header.Customer_Bill_Customer_No = 'Butler') OR
(dbo.Tbl_Sales_Header.Customer_Bill_Customer_No = 'MWI') OR
(dbo.Tbl_Sales_Header.Customer_Bill_Customer_No = 'NLS') OR
(dbo.Tbl_Sales_Header.Customer_Bill_Customer_No = 'HSI') OR
(dbo.Tbl_Sales_Header.Customer_Bill_Customer_No = 'NLSMVD') OR
(dbo.Tbl_Sales_Header.Customer_Bill_Customer_No = 'RNEXT')
GROUP by Tbl_Sales_Header.Sales_Header_Document_Id,Tbl_Sales_Header.Sales_Header_Your_Reference
HAVING COUNT(Sales_Header_Your_Reference) > 1
order by Tbl_Sales_Header.Sales_Header_Document_Id, Tbl_Sales_Header.Sales_Header_Your_Reference

View 9 Replies View Related

Removing Special Characters From A Number String.

Jul 11, 2001

Hi,

I was wondering what would be the best way to remove special characters like, '-', '&' '(',')','#','*', etc... from a number string. To be specific a phone Number string where the string is >= 10.

Thanks, Mark

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved