Comments on: Removing Null Characters (0x00) From Values in SQL Server https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/ Tips on .Net, SQL Server, Sharepoint & AI Tue, 28 Dec 2021 15:04:19 +0000 hourly 1 https://wordpress.org/?v=6.3.5 By: juan pablo Gomez Serna https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/#comment-38866 Tue, 28 Dec 2021 15:04:19 +0000 http://blogs.visigo.com/chriscoulson/?p=108#comment-38866 Great still works on 2022

]]>
By: Nadeem Ilyas https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/#comment-38655 Wed, 11 Oct 2017 07:33:19 +0000 http://blogs.visigo.com/chriscoulson/?p=108#comment-38655 Thanks mate, works fine for me 🙂

REPLACE(CAST(COLUMN_NAME as varchar(max)) COLLATE SQL_Latin1_General_CP1_CI_AS, CHAR(0), ”)

]]>
By: Alex https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/#comment-38386 Mon, 09 Feb 2015 19:01:23 +0000 http://blogs.visigo.com/chriscoulson/?p=108#comment-38386 I goggled and successful used this way of eliminating the null character:
select Replaced = replace(‘BAD_STRING_OR_COLUMN_NAME’ COLLATE Latin1_General_BIN, nchar(0x00) COLLATE Latin1_General_BIN , ”)

To see the difference run this:
select Replaced = ‘BAD_STRING_OR_COLUMN_NAME’ COLLATE Latin1_General_BIN + nchar(0x00) + ‘|||’
select Replaced = replace(‘BAD_STRING_OR_COLUMN_NAME’ COLLATE Latin1_General_BIN + nchar(0x00) + ‘|||’, nchar(0x00) COLLATE Latin1_General_BIN , ”)

]]>
By: IG https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/#comment-38321 Thu, 01 May 2014 03:00:17 +0000 http://blogs.visigo.com/chriscoulson/?p=108#comment-38321 10 out 10. Exactly what I was looking for. Worked perfectly and saved my bacon. Thanks! : )

]]>
By: Varun https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/#comment-38258 Wed, 15 Jan 2014 12:08:34 +0000 http://blogs.visigo.com/chriscoulson/?p=108#comment-38258 Perfect answer. After looking around and googling for hours, I got it here. Many thanks.

]]>
By: Karthik https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/#comment-38187 Mon, 16 Sep 2013 11:39:37 +0000 http://blogs.visigo.com/chriscoulson/?p=108#comment-38187 This solution is working fine …..with the columns those having null value

Thanks for the post……

]]>
By: Bruce https://blogs.visigo.com/chriscoulson/removing-null-characters-0x00-from-values-in-sql-server/#comment-5744 Fri, 30 Nov 2012 21:50:11 +0000 http://blogs.visigo.com/chriscoulson/?p=108#comment-5744 This works great, unless you need to retain the unicode characters. The conversion to VARCHAR rips that away. (or more accurately, converts it to the ascii character that occupies the same byte position in the ascii character table)

Not really a solution for dealing with data in an international user environment.

]]>