Results 1 to 3 of 3
  1. #1
    Join Date
    May 2011
    Posts
    1

    Unanswered: problem with SQl server data insert

    I am inserting data to SQL server DB, I process the values from a string.
    when i look on the DB, i can find a weired characters. enclosed an image, someone can tell me how can i remove this characters?

    Thanks
    useem
    Attached Thumbnails Attached Thumbnails error.jpg  

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    The most likely values of those special characters are TAB, Line Feed and Carriage Return. This is a way to find them
    Code:
    SELECT * 
    from #DaTable
    where CHARINDEX(CHAR(9), Col1) > 1 OR -- TAB
    CHARINDEX(CHAR(10), Col1) > 1 OR -- Line Feed
    CHARINDEX(CHAR(13), Col1) > 1 -- Carriage Return
    You could do a REPLACE (Col1, CHAR(9), '') to get rid of those.

    If you can not replace all strange characters this way, you can find out what they are by looking at their ASCII-code and consulting an ASCII-chart:
    Code:
    SELECT ASCII(SUBSTRING(Col1, 1, 1))
    FROM DaTable
    There may be better ways, but this will get you started.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Maybe you do not have all the character sets installed on your local machine. How do these look to you?
    Code:
    declare @cyrillic int
    declare @hirigana int
    set @cyrillic = convert(int, 0x0400)
    set @hirigana = convert(int, 0x3040)
    
    select top 100 nchar(row_number() over (order by object_id) + @cyrillic) as character, row_number() over (order by object_id) + @cyrillic as codepoint
    from sys.objects
    
    select top 100 nchar(row_number() over (order by object_id) + @hirigana) as character, row_number() over (order by object_id) + @hirigana as codepoint
    from sys.objects

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •