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
Similar Messages
-
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,
VenkatHi 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 -
Hi,
I have to remove special characters from string and replace it with space.
Kindly help its urgent.
ThanksHi,
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 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 -
Sql to remove special characters from my search
Hi everyone. I'm very new to sql and have hit another road block. I am doing a query on my database in oracle sql developer. I want to search manufacturer numbers but sometimes they were entered with dashes ( 999-99-9999) and other times not (999999999) is it possible to apply a function to overlook the dash in both my query numbers and in the database mfr_nbr column?
any help would be appreciated.
Kellyok, I have built a nesting string of replaces to remove all of my special characters and it worked perfectly but now I am not sure where to place the nest later in the string to remove it from my search of mfr numbers. The reason I need to do it again is because I want to remove the characters so I am searching in terms of " apples to apples" so to speak. here is my string so far. I still need to add the part where I put in my search for the manuf_item_nbr. my question is where do I need to place the nested replace's to remove it from my numbers I'm going to search?
SELECT MAX(item_nbr) ,REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE( manuf_item_nbr, ' '), ','), '<'), '.'), '>'), '?'), ''), '"'), ';'), ':'), '\'), '|'), ']'), '}'), '['), '{'), '='), '+'), '_'), '-'), ')'), '('), '*'), '&'), '^'), '^'), '%'), '$'), '#'), '@'), '!'), '~'), '`'),
manuf_item_nbr ,MAX(description), MAX(description2), MAX(GHX_FULL_ITEM_DESCR), MAX(Cntrct_nbr_txt), MAX(uom_cd) ,
MAX(item_qty), MAX(tier_descr), MAX(tier_prc_amt),MAX(list_prc_amt), MAX(vndr_nm), MAX(vndr_id), MAX(unspsc_nbr),MAX(iss_account) FROM
( SELECT '' AS item_nbr, manuf_item_nbr,'' AS description, '' AS description2,'' AS GHX_FULL_ITEM_DESCR, Cntrct_nbr_txt, uom_cd, CAST(item_qty AS VARCHAR (255)) AS item_qty,tier_descr, CAST ( tier_prc_amt AS VARCHAR (255)) AS tier_prc_amt, CAST (list_prc_amt AS VARCHAR (255)) AS list_prc_amt,
vndr_nm, '' AS vndr_id, '' AS unspsc_nbr,'' AS iss_account FROM ROI.CNTRCT_PRC_LIST
WHERE ACTN_CD <> 'D'
AND ROW_UPDT_TSP IS NULL
UNION ALL
SELECT item_nbr, manuf_item_nbr,'', '', GHX_FULL_ITEM_DESCR,'', purch_uom_txt AS uom_cd,
purch_qoe_txt AS item_qty, '', '' AS tier_prc_amt,'' AS list_prc_amt,
vndr_nm, vndr_id, unspsc_nbr,
gl_cd AS iss_account
FROM ROI.ROI_ITEM_ENRCHD_NUVIA
UNION ALL
SELECT trim(item) AS item_nbr,
trim(manuf_nbr) AS manuf_item_nbr,
trim(description),
trim(description2), '' AS GHX_FULL_ITEM_DESCR, '',
trim(stock_uom ) AS uom_cd,
'' AS item_qty,'', '','' AS tier_prc_amt, '' AS list_prc_amt,'' AS vndr_id, '' AS unspsc_nbr,
CAST( trim(iss_account) AS VARCHAR(255))
FROM ITEMMAST_LAW
)GROUP BY manuf_item_nbr
ORDER BY manuf_item_nbr -
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
asitaRemoves 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 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
TrevorTrevor,
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 >, etc are assigned.
Sergio -
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 careHi 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 -
Remove special characters from incoming data
Hi Varun, You could use either of below.. REG_REPLACE(YOUR_INPUT_STR,^[A-Za-z0-9 ],NULL) -- Replaces all non-alphanumeric with null
REG_EXTRACT(YOUR_INPUT_STR,[A-Za-z0-9 ]) -- Extracts only alphanumeric data -Rajanii have special character coming in the source data and i want to remove it before loading into target, currently i am getting one special character , it may come as some other type of special character other than alpha numeric. so how to remove those special characters from data and load the alphanumeric data into target.
-
Alternative to remove special characters
Hi All,
There are some special characters in the varchar2 field which stores date values.
Any Alternative for this code :
WHERE TO_CHAR (LENGTH (TRANSLATE (TRIM (num_column),
'*0123456789',
) IS NULL;
While selecting the data using analytical function getting error message - invalid number.
I have not created this table.
Thanksis the '*' character always in the first position?
If so, then one could do
select num_column
from
select num_column, substr(num_column,1,1) first_char
from t
where rtrim (first_char, '0123456789') is not null -
Remove special characters in string
Hi all,
I'm Portuguese, and in our language we use special characters in words like "João or "Sónia".
I need to take off these special characters, which means I want to have the same words like "Joao" and "Sonia", without the characters "~" or "´".
Do you have any idea how can I do this?
Thanks in advance.
Best regards,
Sónia GonçalvesHi,
But I want to make this generic, I don't want to replace character by character.
If I give a string in the program, I want to search all ocurrences of these special characters and replace them.
How can I do this?
Thanks.
Best regards,
Sónia Gonçalves -
Removing special characters from a string
Hi All,
I have this in one my column in my table
ABC-DEF
ABC/DEF
ABC,DEF
ABC DEF
I want to remove -, /, comma and space so i want the result like this
ABCDEF
ABCDEF
ABCDEF
ABCDEF
How can I do this in PL/sql.
Thanks.Use REGEXP_REPLACE:
with sample_table as (
select 'ABC-DEF' str from dual union all
select 'ABC/DEF' from dual union all
select 'ABC,DEF' from dual union all
select 'ABC DEF' from dual
-- end of on-the-fly sample table
select str,
regexp_replace(str,'[-/, ]') new_str
from sample_table
STR NEW_STR
ABC-DEF ABCDEF
ABC/DEF ABCDEF
ABC,DEF ABCDEF
ABC DEF ABCDEF
SQL> SY. -
Remove special characters in xml
hi all,
i have a problem with special char.
in my data few records have special char like ' or "
because of that xml file gives error.
let me know the solution to this .
thanks in advance
Edited by: 836924 on Mar 8, 2011 1:41 AMHi;
What is your EBS version? What is exact error message?
Please see:
Junk Characters in Period Close Exceptions Report (XML) When Run as PDF Format [ID 1093011.1]
How To Install a Font Using XML Publisher Administrator [ID 373377.1]
Also see:
XML publisher Troubleshooting
oracle.apps.fnd.cp.opp.PostProcessorException: XML Publisher output file no
Regard
Helios -
Re: remove special characters from incoming data
Dear Varun Kumar, Please use this logic. REG_REPLACE(INPUT FIELD,'[^A-Za-z0-9]' ,'')Only Characters and Numbers it will come. I Tried Same Logic it working. Please let me Know. Thanks & RegardsKasireddy+966545281845
Hi Varun, You could use either of below.. REG_REPLACE(YOUR_INPUT_STR,^[A-Za-z0-9 ],NULL) -- Replaces all non-alphanumeric with null
REG_EXTRACT(YOUR_INPUT_STR,[A-Za-z0-9 ]) -- Extracts only alphanumeric data -Rajani -
hi all,
I have a string like this:
VIS WAN/-#%@ TH
I need an output like VISWANATH
i think there must be some ascii way aroud..would u pls help me out?This can be done in plain sql
sql>
select replace(translate('VIS WAN/-#%@ TH ',
translate('VIS WAN/-#%@ TH ','abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',' '),' '),' ') str
from dual;
STR
VISWANTH
Message was edited by:
jeneesh
formatted
Maybe you are looking for
-
I have a hp color laserjet cp2025 connected by USB to the latest time capsule by usb. The printer frequently drops off the network - print jobs can't find the printer. The only way to fix is to unplug (power) the time capsule and restart it. Any t
-
Is it possible for deleting all the apps from the appstore which are showing up in the apps not on my phone section. Before I was able to delete them from itunes but now I am not able to find that option.
-
ADDING CONTACTS TO ADDRESS BOOK SERVER!!!!!!!!!
Can someone please help me figure out how to add contacts to the address book server. I tried to drag my contacts but it doesn't work. There is no "+" button for me to add new contacts. I've been trying for a couple days and nothing. Thank you in adv
-
Where is my key of windows 8 for my laptop
I bought this laptop and it need the key to register the windows 8 ... but the box doesnt have any cd or dvd i need the key and I dont have so much time to go back to the store can you help me please???? I have already send a message in the spanish
-
Deploy Consumer Grade Windows Laptops On Domain?
We are considering purchasing some low end laptops that will be used for the main purpose of users accessing their primary workstation remotely from home. HP Stream 14 looks like a candidate. It comes with 8.1 "home" edition OEM. So, we would need