Determine varchar content in nvarchar columns Determine varchar content in nvarchar columns sql-server sql-server

Determine varchar content in nvarchar columns


Why not cast there and back to see what data gets lost?

This assumes column is nvarchar(200) to start with

SELECT *FROM TableNameWHERE columnName <> CAST(CAST(columnName AS varchar(200)) AS nvarchar(200))


Hmm interesting.

I'm not sure you can do this in a SQL query itself. Are you happy to do it in code? If so, you can get all the records, then loop over all the chars in the string and check. But man it's a slow way.