Skip to content

Select from excel with replace function .net 2

Liat Ashkenazi

Asked Sep 7, 2011, 11:12 PM EDT5 answers
Share
LinkedInX
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.

5 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Jiteendra Sampathirao
    0
    Hi,

    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....
    0
  • 0
    Hi,
    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?
    0
  • 0
    I added output like that \"output\" and the error now is :Undefined function 'replace' in expression. like the first error.
    0
  • Jiteendra Sampathirao
    0
    Hi,

    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......
    0
  • 0
    Hi,
    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.
    0