Hi all,
I need to select replace(X,oldvalue,newvalue) from tbl.
I get error message that replace function is not recognize.
I use oledbcommand.
with .net 2.
how can I use replace,substring function.
Thanks.
Select from excel with replace function .net 2
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Jiteendra SampathiraoRank #586 · 4.1K pointsPosted Sep 7, 2011, 11:39 PM EDT
The following example replaces occurrences of J with G:
SELECT REPLACE('JITENDRA and JAJI','J','G') "OUTPUT" FROM DUAL;
OUTPUT
--------------
GITEDRA and GAGI
hope it help you....
Liat Ashkenazi11 pointsPosted Sep 8, 2011, 12:09 AM EDT
I added "output"
and now I get this Error: Syntax error (missing operator) in query expression 'replace([Lab],'G','L') "OUTPUT"'.
what the Output word mean?
Liat Ashkenazi11 pointsPosted Sep 8, 2011, 12:33 AM EDT
Jiteendra SampathiraoRank #586 · 4.1K pointsPosted Sep 8, 2011, 1:08 AM EDT
SELECT REPLACE('JITENDRA and JAJI','J','G') "OUTPUT" FROM DUAL;
This means.. if J letter is there in the string replace it with G....and OUTPUT is a column_name...
your query is like this select REPLACE('Lab', 'G', 'L') "OUTPUT" from dual
So in the string (Lab) there is no G so it shows an error..
write like this
select REPLACE('Lab', 'L', 'G') "OUTPUT" from dual
your output will be Gab
hope it help you......
Liat Ashkenazi11 pointsPosted Sep 8, 2011, 1:25 AM EDT
Lab is a column in the excel file.
so I want to get the value in the lab column and replace the letter G with L foe example.