Geeks With Blogs

News
The Wrecking Bawl Destructuring query language, one keyword at a time.

I imported a text file into SQL Server 2005 today and ended up with squares at the end of the last column.  Turns out the text file, despite being tab delimited, had a tab prior to CR/LF at the end of each row.  I was confused at first as to how to get rid of the squares, but then I figured it out.

SELECT ASCII(RIGHT(column,1)) FROM table  --gives 9, which is TAB in the ASCII table

UPDATE table SET column = REPLACE(column, CHAR(9), '')  --replaces tabs with nothing

 

 

Posted on Monday, December 11, 2006 4:21 PM all tech stuff , SQL Server | Back to top


Comments on this post: unknown chars in SQL Server

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Alex Bransky | Powered by: GeeksWithBlogs.net