0

I have certain records in my DE, where the first name contains '�'. I wish to extract such records. Obviously a like wouldn't work. Is there a way to do this in SQL Query Activity.

2 Answers 2

1

I tried to reproduce your issue in my instance.

You can see one row is fine but the other row has has special characters as per the below screenshot:

enter image description here

You can use the below SQL Query :

Select [Template Identifier],Country,[Reservation Text],[Booking Text] 
from [Test Dynamic Text]
where [Booking Text] <> CONVERT(varchar, [Booking Text])

At the resultant data extension am getting only one row which has the special characters. Let me know if this helps.

enter image description here

2
  • Worked... Thanks Naveen! Commented May 13, 2020 at 8:31
  • You are welcome @smsy31!
    – Naveen VM
    Commented May 13, 2020 at 9:12
3

You can find those records containing multi-byte characters by converting the First Name field to a single-byte data type and then comparing against the First Name for equality:

SELECT 
    FirstName
FROM 
    MyDataExtension
WHERE
    FirstName != cast(FirstName as varchar(1000))

If you're specifically interested in locating records that contain the unicode replacement character, '�', then narrow down your comparison to just this one character code:

SELECT 
    FirstName
FROM 
    MyDataExtension
WHERE
    CHARINDEX(NCHAR(65533) COLLATE Latin1_General_BIN,FirstName) > 0
3
  • let me try, as my first name also has other valid characters like Æ Commented May 12, 2020 at 11:07
  • This is not working, it is just returning all the names with special characters Commented May 12, 2020 at 11:34
  • I'll update to search specifically for the unicode replacement character, "�", if you like.
    – Macca
    Commented May 13, 2020 at 0:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .