I'm running into a wierd bug that I can't figure out.
I have a column that stores email addresses. For whatever reason, the person who designed this application decided to make it store the email address twice in the same column.
So the data looks like: email@email.com email@email.com
Should be simple to parse right?
Only that returns 0's for all the rows.
If I COPY the email out of the SQL results and do it manually, it works fine.
select charindex(' ', 'email@email.com email@email.com')
returns: 16
Just like it should.
So it's a data type issue perhaps? Well the data type in the table is nvarchar, and I've tried converting or casting it to varchar or char inside of the charindex and still no dice.
I can't figure this out... anyone have any ideas? Could there be a hidden soft return or some kind of wierd data bit that is stored in the column where the space is showing? How do I search for something like that?
I have a column that stores email addresses. For whatever reason, the person who designed this application decided to make it store the email address twice in the same column.
So the data looks like: email@email.com email@email.com
Should be simple to parse right?
Code:
select charindex(' ', from)
from table
Only that returns 0's for all the rows.
If I COPY the email out of the SQL results and do it manually, it works fine.
select charindex(' ', 'email@email.com email@email.com')
returns: 16
Just like it should.
So it's a data type issue perhaps? Well the data type in the table is nvarchar, and I've tried converting or casting it to varchar or char inside of the charindex and still no dice.
I can't figure this out... anyone have any ideas? Could there be a hidden soft return or some kind of wierd data bit that is stored in the column where the space is showing? How do I search for something like that?