replace with other database

shireeshn

Member
ABC is a database, in this database i have one table with same name ABC. I want to replace the database ABC with other DATABASE name AAA

example :-

1) find abc.def where abc.def.def-code = abc.ghi.def-code no-lock no-error.
2) find abc.abc where abc.abc.def-code = abc.ghi.def-code no-lock no-error.

after replacing it should be
1)find AAA.def WHERE AAA.def.def-code = AAA.def.def-code = AAA.ghi.def-code AND AAA.ghi.def-code no-lock no-error.
2)find AAA.abc WHERE AAA.abc.def-code = AAA.abc.def-code = AAA.ghi.def-code AND AAA.ghi.def-code no-lock no-error.

This is an easy task but see below one

AS we all know some times user will not enter the database with table then when he uses ABC table
3)find abc where abc.def-code = abc.ghi.def-code and abc.abc-desc = abc.ghi.ghi-desc no-lock no-error.

After replacing it should be
3)find abc where abc.def-code = AAA.ghi.def-code and abc.abc-desc = AAA.ghi.ghi-desc no-lock no-error.

last point i have a trouble, my code is below, can some one correct it or help me slove the last problem.

IF INDEX(inLine, " abc.abc " , " AAA.abc " ) > 0 THEN
inLine = REPLACE(inLine, " abc.abc " , " AAA.abc " ) .
IF INDEX(inLine, " abc.abc." , " AAA.abc." ) > 0 THEN
inLine = REPLACE(inLine, " abc.abc." , " AAA.abc." ).

for third point i want to write like this
IF INDEX(inLine, " abc." ) > 0 THEN
inLine = REPLACE(inLine, " abc.", " AAA." ).

but it will replace the abc table also with " AAA." which is wrong iam geting like this which is wrong.
3) find abc where AAA.def-code = AAA.ghi.def-code and AAA.abc-desc = AAA.ghi.ghi-desc no-lock no-error.

can any one help me in this, to get correct result as expected above
 

tamhas

ProgressTalk.com Sponsor
To do syntactically aware search and replace, look at Proparse and ProRefactor ... anything else is a hair-puller.
 
Top