How to remove special characters in a particular column

Hello,
i have a csv feed and i load it into a sql table (the sql table has all varchar data type fields)
feed data looks like (just sampled 2 rows but my file has thousands of like this)
"K" "AIF" "AMERICAN IND FORCE" "FRI" "EXAMP" "133" "DISPLAY" "505250" "MEDIA INC." 03/01/10" "INV31202" ".00" ".00" "0.00" "ALLO" ;
"K" "AIF" "AMERICAN IND FORCE" "THU" "TRTH" "123" "MUN MARCH 2010" "505099" "SOCIALTYZE" "03/01/10" "1308" "40,282.32" "40,282.32" "45564.64" "DIS" ;
some times i got some special characters in my table column (example: in my invoice no column some time i do have # or ! kind of invalid characters ) so how can i remove some kind of special characters in my column
once it is eliminated then i can write it to new table (with correct data format such as integer)
could some one please tell me how can i remove special character in a column of particular table
thanks in advance
asita

Removes any characters from
@myString that do not meet the
provided criteria.
CREATE FUNCTION dbo.GetCharacters(@myString varchar(500), @validChars varchar(100))
RETURNS varchar(500) AS
BEGIN
While @myString like '%[^' + @validChars + ']%'
Select @myString = replace(@myString,substring(@myString,patindex('%[^' + @validChars + ']%',@myString),1),'')
Return @myString
END
Go
Declare @testStr varchar(1000),
@i int
Set @i = 1
while @i < 255
Select
@TestStr = isnull(@TestStr,'') + isnull(char(@i),''),
@i = @i + 1
Select @TestStr
Select dbo.GetCharacters(@TestStr,'a-z')
Select dbo.GetCharacters(@TestStr,'0-9')
Select dbo.GetCharacters(@TestStr,'0-9a-z')
Select dbo.GetCharacters(@TestStr,'02468bferlki')
perfect soluction

Similar Messages

  • How to remove special characters while typing data in edit cell in datagrid in flex4

    Hi Friends,
    I am facing this problem "how to remove special characters while typing data in edit cell in datagrid in flex4".If know anyone please help in this
    Thanks,
    Anderson.

    Removes any characters from
    @myString that do not meet the
    provided criteria.
    CREATE FUNCTION dbo.GetCharacters(@myString varchar(500), @validChars varchar(100))
    RETURNS varchar(500) AS
    BEGIN
    While @myString like '%[^' + @validChars + ']%'
    Select @myString = replace(@myString,substring(@myString,patindex('%[^' + @validChars + ']%',@myString),1),'')
    Return @myString
    END
    Go
    Declare @testStr varchar(1000),
    @i int
    Set @i = 1
    while @i < 255
    Select
    @TestStr = isnull(@TestStr,'') + isnull(char(@i),''),
    @i = @i + 1
    Select @TestStr
    Select dbo.GetCharacters(@TestStr,'a-z')
    Select dbo.GetCharacters(@TestStr,'0-9')
    Select dbo.GetCharacters(@TestStr,'0-9a-z')
    Select dbo.GetCharacters(@TestStr,'02468bferlki')
    perfect soluction

  • How to remove special characters in xml

    Dear friends,
    How to remove the special character  from the xml. I am placing the xml file and  fetching through file adapter.
    The problem is when there is any special character in xml. i am not able to pass to target system smoothly.
    Customer asking schedule the file adapter in order to do that the source xml should not have any special charatcters
    How to acheive this friends,
    Thanx in advance.
    Take care

    Hi Karthik,
    Go throgh the following links how to handle special character
    https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
    Restricting special characters in XML within XI..
    Regards
    Goli Sridhar

  • How to restrict special characters for a specific column

    Dear gurus,
    i have a table emp with a field field_1
    in this particular field_1 is an address column where data can be like '12 st first floor' but suppose mistakenly user has entered the data as '12 st first floor & ' it should be restricted (not using trigger but can this be possible by using constraints )so for this how can we restrict the special characters not to get entered into the column.
    regards,
    friend

    Another way of doing it.
    drop table test_table;
    create table test_table (col varchar2(50));
    alter table test_table add constraint chk_address check (NOT regexp_like(col, '[[:punct:]]+'));
    insert into test_table
    (select  'some text' col from dual);
    1 rows inserted.
    insert into test_table
    (select  'some text!' col from dual);
    Error starting at line 20 in command:
    insert into test_table
    (select  'some text!' col from dual)
    Error report:
    SQL Error: ORA-02290: check constraint (FDL_DEV.CHK_ADDRESS) violated
    02290. 00000 -  "check constraint (%s.%s) violated"
    *Cause:    The values being inserted do not satisfy the named check
    *Action:   do not insert values that violate the constraint.
    insert into test_table
    (select  'some text House#32' col from dual);
    Error starting at line 23 in command:
    insert into test_table
    (select  'some text House#32' col from dual)
    Error report:
    SQL Error: ORA-02290: check constraint (FDL_DEV.CHK_ADDRESS) violated
    02290. 00000 -  "check constraint (%s.%s) violated"
    *Cause:    The values being inserted do not satisfy the named check
    *Action:   do not insert values that violate the constraint.
    insert into test_table
    (select  'some text
    (with new line)' col from dual);
    Error starting at line 26 in command:
    insert into test_table
    (select  'some text
    (with new line)' col from dual)
    Error report:
    SQL Error: ORA-02290: check constraint (FDL_DEV.CHK_ADDRESS) violated
    02290. 00000 -  "check constraint (%s.%s) violated"
    *Cause:    The values being inserted do not satisfy the named check

  • How to remove Special characters in XSLT

    Hi
    I have one issue in XSLT transformation,in my input xml I have the < and > symbols but while in response it is coming as &lt due to this we lose some data . so is there any functions to get the symbols.
    Regards
    Mani

    Hi Eric,
    Thanks for reply,I am able to get the <,>,&etc.. in response by using "disable-output-escaping='yes'" but apos and cap symbols, unable to get in the response,how to get these.
    Regards
    Mani

  • Sql: remove special characters

    Hello!
    maybe someone has a hint for me how to remove special characters such as tab/new line characters from columns?
    Thanks in advance!
    Tiberius

    Hmm... actually it's straight forward:
    drop table mytexts
    create table mytexts (comment varchar(50))
    insert into mytexts values ('This is a standard text!')
    insert into mytexts values ('There comes a TAB     <--')
    insert into mytexts values ('This is called a newline
    <--<')
    select * from mytexts
    | COMMENT                                            |
    | -------------------------------------------------- |
    | This is a standard text!                           |
    | There comes a TAB     <--                              |
    | This is called a newline
    <--<                     |
    3 rows selected (1375 usec)
    sqlcli db770=> select replace (replace(comment, '       '), '
    > ') as cleaned_comment from mytexts
    > ;
    | CLEANED_COMMENT                                    |
    | -------------------------------------------------- |
    | Thisisastandardtext!                               |
    | TherecomesaTAB<--                                  |
    | Thisiscalledanewline<--<                           |
    3 rows selected (1662 usec)
    Seems to work...
    regards,
    Lars

  • Need to remove special characters

    Hello All
        Some input is comming from source field, if any special characters comming from source field, I need remove special characters and send data source to target field. please suggest me how will i do .
    Thanks&Regards,
    Venkat

    Hi Venkat,
    check this thread.
    Handling Special Characters
    check the document :
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
    Depends upon encoding methods handling will differ,
    you can use ISO-8859-1 or ISO-8859-2 instead of UTF-8 for some special characters.
    check this blog:
    /people/ulrich.brink/blog/2005/08/18/unicode-file-handling-in-abap
    cheers
    Sunil

  • How to print Special Characters in Sap-Scripts

    How to print Special Characters in Sap-Scripts
    Thanks,
    Ravi

    Hi
    if u want print special characters we can use hot codes i.e '  '  (single inverted commas). in between these hot codes insert u r special characters.
    write    '    !@#$%^&*( )  '.
    for the above write statement output is
    output is   !@#$%^&*( )

  • How to write special characters in PDF using iText

    How to write special characters encoded with UTF-8 in PDF using iText.
    Regards,
    Pandharinath.

    I don't know what your problem is but that's almost certainly the wrong question to ask about it. Java (including iText) uses only Unicode characters. (You may consider some of them to be "special" if you like but Unicode doesn't.) And when it does that, they aren't encoded in UTF-8 or any other encoding.
    So can you describe your problem? That question doesn't make sense.

  • How to display special characters in Script...

    hi all,
    Can any one tell me how to display special characters in script...
    how to write in text element
    thanks in advance,
    prashant

    Hi Prashant ,
      What special characters would you like to include .
    There are a set of characters / icons /symbols that can be included in Script , for that open a window in edit mode and in the menu there will be an option called Insert  , here you can find a lot of characters/symbols that can be included .
    Regards,
    Arun

  • How to remove the Linked Button in particular forms

    How to remove the linked button in particular sap b1 forms.

    Hi,
    In standard B1 Forms, we can't remove the linked button.
    Why you want to remove linked button.
    I think, the user don't want open the master data?
    In such cases you can use the authorization for the users to access the master data.
    Hope this will help you.
    Regards,
    Venkatesan G.

  • Removing special characters

    Hi,
    I have to remove special characters from string and replace it with space.
    Kindly help its urgent.
    Thanks

    Hi,
    You Can use Overlay command for this.
    Syntax
    OVERLAY text1 WITH text2 [ONLY pattern].
    Effect
    Characters in the text1 variable are replaced by characters in the text2 data object which are there in the same location. If the ONLY addition is not specified, all blank characters in text1 are replaced. If the ONLY addition is specified, all characters are replaced that occur in the pattern data object, and upper and lowercase is taken into consideration. If the lengths of text1 and text2 are different, text1 is processed using the shorter length only.
    CONSTANTS initial_time TYPE t VALUE IS INITIAL.
    DATA: time TYPE t,
          text(4) TYPE c.
    text = '12'.
    time = text.
    write : time.
    Thanks,
    Reward If Helpful.

  • How to search special characters in a string

    Hi all,
    I want to search special characters in all string columns and all rows in the table.
    The table has about 5 string columns and about 5.000.000 rows. For each row and column, I have to search entries, which included special characters like ", !, ? or something else (f.ex. "Mama?Mia" or "!!!Hotel out of order!!!"). The problem, the character could stand at each position in the string.
    What's the best and most performance possibility to search such entries?? Is it possibility only by SQL; is there a special function for this?? Or must I use PL/SQL.
    Thanks for helping
    Dana

    HTH
    Laurent Schneider
    OCM DBA
    SQL> select * from z;
    S
    Mama?Mia
    a b c
    123
    SQL> select * from z where translate(s,'~ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz1234567890','~') is not null;
    S
    Mama?Mia
    SQL> select * from z where regexp_like(s, '[^[:alnum:][:space:]]');
    S
    Mama?Mia

  • How do i prevent display of a particular column in ALV

    How do i prevent display of a particular column
    of a structure in ALV

    Hi Serdar,
    Please do let us know the link , as soon as your code sample is put in sdn.sap.com.
    I request the <b>veteran members</b> of this forum to <b>contribute to WebLogs</b> or <b>code samples</b>, since over the time, the same questions will be asked and instead of repeating the answers, we can direct them to Weblogs or Code Samples.
    There is an ABAP FAQ present in this site, which has given insight to so many things, that I have not even considered remotely possible.
    As seen today, there was a useful piece of code posted. Instead of posting the code in the forum, you can create it as a weblog and post it there.
    Regards,
    Subramanian V.

  • How can I remove special characters from spreadsheet filename?

    Hi
    Having a spreadsheet filename coded (on the Report Attributes page) as &VARIABLE..csv works fine unless the VARIABLE contains special characters such as space, lt, gt and so on.
    In the case of space, it is replaced by %20 in the generated filename. Is it possible convert the %20s to underscores (or remove them)?
    thanks
    Trevor

    Trevor,
    I would use a computation on that page to alter the value of variable, perhaps a SQL Expression such as:
      replace (:VARIABLE, ' ', '_')Alternatively, look at the process that puts the value into VARIABLE in the first place and ensure no spaces &gt;, etc are assigned.
    Sergio

Maybe you are looking for

  • Problem with iMessage

    Hi all ! I have an Iphone 4 s and I want to use iMessage but i can't use it because it uses money. Why have I got this problem if iMessage sends messages free to all who have iOS ?

  • How to tell JSP for encoding Format??

    Hi all, I have following requirements 1. The user enters data in local language say kannada(indian langauage). The data should be stored in ms-access only in the form of local langauge. Customer dosnt want see some junk values or entity values. His r

  • Project prel file will not open with Premiere 11

    Created slide show and project with Photo Shop Elements 11. Went to Premiere Elements 11 and to File/ Open Project. Found the project listed and selected Open. The project file then showed in the upper right toolbar margin. Upon using Publish + Share

  • How do I go back to Photoshop CC ? After 2014 downloaded, and the panals were gone, I want to go back to the CC version.. All of my extensions are on CC..

    Please tell me how to revert to the previous version of Photoshop and the programs that went with it ?? The default in Windows Explorer is the 2014 version , with no option for CC at all. I can't even change it on the default extension on windows. I

  • Backing up itunes database

    I am in the process of creating an itunes library with about 1200 playlists. My audio files are kept on an external hard drive, so  am not worried about losing them if my Mac mini or itunes crashes. Can someone tell me if there is a way to back up th