SQL - SAP HANA - REPLACE_REGEXPR in Column table
up vote
0
down vote
favorite
I have some tables on SAP HANA and „create column table“ to combine multiple „raw tables“ and need to replace strings from one column in the newly created table. Tablename “Testsubject_status” Column name “STATUS”.
The reason why I need to replace the strings, is to get a harmonized wording on specific entries.
With the following example, it is hopefully more clear what I mean:
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test with the ID 1237 is done
- Test her
- Test with the ID 928162 is done
- Test with the ID 991 is done
The result should be
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test is done
- Test her
- Test is done
- Test is done
I tried the following:
CREATE COLUMN TABLE SCHEMATTT.Testsubject_status AS (
Select
Table1.Person AS “Person”,
Table1.Vers AS “Vers”,
Table2.Flnr AS “Flnr”,
Table3.Status AS “Status”
FROM
SCHEMATTT.Table1, SCHEMATTT.Table2, SCHEMATTT.Table3
WHERE SCHEMATTT.Table1.Person = SCHEMATTT.Table2.Person
AND SCHEMATTT.Table2.Flnr = SCHEMATTT.Table3.Flnr
SELECT
REPLACE_REGEXPR (‘with the id d{1,}’ IN ‘TEST with %’ WITH ‘’) “replace_regexpr”
FROM SCHEMATTT.Testsubject_status
);
Creating the table is working. The Replace_Regexpr statement is only working if I do not run it together with the create column table statement and then only creates a table with one column and the entries ‘TEST with %’ in every row.
Additional info:
- There is not only the “Test is done” string that needs to be harmonized, but a few others as well. So I need to use the replace statement more than once in this specific column “Status”
- The "Test is done" Statement is not 1:1 with another Statement in the table, so the other statements can't be used in any way to do this :-)
Not sure if creating the table in this way is the best one, but I guess that’s another story
Thank you in advance for your input!
This Picture is for clarification in the comments:
sql sap hana
add a comment |
up vote
0
down vote
favorite
I have some tables on SAP HANA and „create column table“ to combine multiple „raw tables“ and need to replace strings from one column in the newly created table. Tablename “Testsubject_status” Column name “STATUS”.
The reason why I need to replace the strings, is to get a harmonized wording on specific entries.
With the following example, it is hopefully more clear what I mean:
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test with the ID 1237 is done
- Test her
- Test with the ID 928162 is done
- Test with the ID 991 is done
The result should be
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test is done
- Test her
- Test is done
- Test is done
I tried the following:
CREATE COLUMN TABLE SCHEMATTT.Testsubject_status AS (
Select
Table1.Person AS “Person”,
Table1.Vers AS “Vers”,
Table2.Flnr AS “Flnr”,
Table3.Status AS “Status”
FROM
SCHEMATTT.Table1, SCHEMATTT.Table2, SCHEMATTT.Table3
WHERE SCHEMATTT.Table1.Person = SCHEMATTT.Table2.Person
AND SCHEMATTT.Table2.Flnr = SCHEMATTT.Table3.Flnr
SELECT
REPLACE_REGEXPR (‘with the id d{1,}’ IN ‘TEST with %’ WITH ‘’) “replace_regexpr”
FROM SCHEMATTT.Testsubject_status
);
Creating the table is working. The Replace_Regexpr statement is only working if I do not run it together with the create column table statement and then only creates a table with one column and the entries ‘TEST with %’ in every row.
Additional info:
- There is not only the “Test is done” string that needs to be harmonized, but a few others as well. So I need to use the replace statement more than once in this specific column “Status”
- The "Test is done" Statement is not 1:1 with another Statement in the table, so the other statements can't be used in any way to do this :-)
Not sure if creating the table in this way is the best one, but I guess that’s another story
Thank you in advance for your input!
This Picture is for clarification in the comments:
sql sap hana
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have some tables on SAP HANA and „create column table“ to combine multiple „raw tables“ and need to replace strings from one column in the newly created table. Tablename “Testsubject_status” Column name “STATUS”.
The reason why I need to replace the strings, is to get a harmonized wording on specific entries.
With the following example, it is hopefully more clear what I mean:
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test with the ID 1237 is done
- Test her
- Test with the ID 928162 is done
- Test with the ID 991 is done
The result should be
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test is done
- Test her
- Test is done
- Test is done
I tried the following:
CREATE COLUMN TABLE SCHEMATTT.Testsubject_status AS (
Select
Table1.Person AS “Person”,
Table1.Vers AS “Vers”,
Table2.Flnr AS “Flnr”,
Table3.Status AS “Status”
FROM
SCHEMATTT.Table1, SCHEMATTT.Table2, SCHEMATTT.Table3
WHERE SCHEMATTT.Table1.Person = SCHEMATTT.Table2.Person
AND SCHEMATTT.Table2.Flnr = SCHEMATTT.Table3.Flnr
SELECT
REPLACE_REGEXPR (‘with the id d{1,}’ IN ‘TEST with %’ WITH ‘’) “replace_regexpr”
FROM SCHEMATTT.Testsubject_status
);
Creating the table is working. The Replace_Regexpr statement is only working if I do not run it together with the create column table statement and then only creates a table with one column and the entries ‘TEST with %’ in every row.
Additional info:
- There is not only the “Test is done” string that needs to be harmonized, but a few others as well. So I need to use the replace statement more than once in this specific column “Status”
- The "Test is done" Statement is not 1:1 with another Statement in the table, so the other statements can't be used in any way to do this :-)
Not sure if creating the table in this way is the best one, but I guess that’s another story
Thank you in advance for your input!
This Picture is for clarification in the comments:
sql sap hana
I have some tables on SAP HANA and „create column table“ to combine multiple „raw tables“ and need to replace strings from one column in the newly created table. Tablename “Testsubject_status” Column name “STATUS”.
The reason why I need to replace the strings, is to get a harmonized wording on specific entries.
With the following example, it is hopefully more clear what I mean:
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test with the ID 1237 is done
- Test her
- Test with the ID 928162 is done
- Test with the ID 991 is done
The result should be
Table name: Testsubject_status --- Column: Status
- Test me
- Test him
- Test is done
- Test her
- Test is done
- Test is done
I tried the following:
CREATE COLUMN TABLE SCHEMATTT.Testsubject_status AS (
Select
Table1.Person AS “Person”,
Table1.Vers AS “Vers”,
Table2.Flnr AS “Flnr”,
Table3.Status AS “Status”
FROM
SCHEMATTT.Table1, SCHEMATTT.Table2, SCHEMATTT.Table3
WHERE SCHEMATTT.Table1.Person = SCHEMATTT.Table2.Person
AND SCHEMATTT.Table2.Flnr = SCHEMATTT.Table3.Flnr
SELECT
REPLACE_REGEXPR (‘with the id d{1,}’ IN ‘TEST with %’ WITH ‘’) “replace_regexpr”
FROM SCHEMATTT.Testsubject_status
);
Creating the table is working. The Replace_Regexpr statement is only working if I do not run it together with the create column table statement and then only creates a table with one column and the entries ‘TEST with %’ in every row.
Additional info:
- There is not only the “Test is done” string that needs to be harmonized, but a few others as well. So I need to use the replace statement more than once in this specific column “Status”
- The "Test is done" Statement is not 1:1 with another Statement in the table, so the other statements can't be used in any way to do this :-)
Not sure if creating the table in this way is the best one, but I guess that’s another story
Thank you in advance for your input!
This Picture is for clarification in the comments:
sql sap hana
sql sap hana
edited Nov 13 at 12:37
asked Nov 12 at 10:22
Mike B
145
145
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
@Mike, could you please try following SQLScript command
CREATE COLUMN TABLE Testsubject_status2 AS (
Select
Table1.Person AS "Person",
Table1.Vers AS "Vers",
Table2.Flnr AS "Flnr",
Table3.Status AS "Status",
REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr"
FROM
Table1, Table2, Table3
WHERE Table1.Person = Table2.Person
AND Table2.Flnr = Table3.Flnr
);
This will produce a table with following sample data
Note that the STATUS column is replaced with a static text if there is a match for the given condition. Else the STATUS text is kept as it is
For the additional info, I added following expressions but I did not like it much
Maybe there are better solutions
REPLACE_REGEXPR (
'(test with the id|Deployment for the ID) [[:digit:]]* is (done|completed)'
FLAG 'i'
IN Table3.STATUS
WITH
case
when Table3.STATUS LIKE_REGEXPR('test') Flag 'i' then 'test is done'
when Table3.STATUS LIKE_REGEXPR('deploy') Flag 'i' then 'deployment is done'
else Table3.STATUS
end
) as "replace_regexpr_ext"
You can add this add a new calculated column in your table definitions script
I assume you have following status text in your table data:
- Deployment for the ID 234 is completed
- Deploy development
Thank you very much Eralper, really! The Statement is finally working! As stated in the "additional Info" part of my post, I would need to replace other Strings like the "Test is done“ as well. If I put the REPLACE_REGEXPR Statement in a CASE WHEN Table3.Status like ‘test with the ID % is done’ then REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr" ELSE WHEN xxxxx ELSE WHEN xxx ELSE Table3.STATUS end as replace_regexpr FROM Table3 I get a Syntax is incorrect near """ error message. Do you know what the Problem could be?
– Mike B
Nov 13 at 9:05
I added a new expressions that you can use as a seperate column data in your code, I hope it helps
– Eralper
Nov 13 at 11:16
Again, thank you very much Eralper, Maybe I was not clear enough with my wording About the different Status entries. The do not only have this pattern like you assumed. Just to Name a few: Test [[with the ID 1237]] is done, Ticketnumber[[: 9G62J]], [[OE_1559C: ]]New RSKT.... in these examples the part that needs to be removed is marked in [] …. sorry for the missunderstanding and thanks again for your patients and help! Edit: I have about 20 different wordings that need to be harmonized
– Mike B
Nov 13 at 11:26
And as a result what do you want to see in the output? You can use " | " pipe sign to search for static text in status, but if you want to modify the output then maybe we should use place holders
– Eralper
Nov 13 at 11:59
Test [[with the ID 1237]] is done should be Test is done - Ticketnumber:9G62J should be Ticketnumber - OE_1559C: New RSKT should be New RSKT
– Mike B
Nov 13 at 12:09
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53260132%2fsql-sap-hana-replace-regexpr-in-column-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
@Mike, could you please try following SQLScript command
CREATE COLUMN TABLE Testsubject_status2 AS (
Select
Table1.Person AS "Person",
Table1.Vers AS "Vers",
Table2.Flnr AS "Flnr",
Table3.Status AS "Status",
REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr"
FROM
Table1, Table2, Table3
WHERE Table1.Person = Table2.Person
AND Table2.Flnr = Table3.Flnr
);
This will produce a table with following sample data
Note that the STATUS column is replaced with a static text if there is a match for the given condition. Else the STATUS text is kept as it is
For the additional info, I added following expressions but I did not like it much
Maybe there are better solutions
REPLACE_REGEXPR (
'(test with the id|Deployment for the ID) [[:digit:]]* is (done|completed)'
FLAG 'i'
IN Table3.STATUS
WITH
case
when Table3.STATUS LIKE_REGEXPR('test') Flag 'i' then 'test is done'
when Table3.STATUS LIKE_REGEXPR('deploy') Flag 'i' then 'deployment is done'
else Table3.STATUS
end
) as "replace_regexpr_ext"
You can add this add a new calculated column in your table definitions script
I assume you have following status text in your table data:
- Deployment for the ID 234 is completed
- Deploy development
Thank you very much Eralper, really! The Statement is finally working! As stated in the "additional Info" part of my post, I would need to replace other Strings like the "Test is done“ as well. If I put the REPLACE_REGEXPR Statement in a CASE WHEN Table3.Status like ‘test with the ID % is done’ then REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr" ELSE WHEN xxxxx ELSE WHEN xxx ELSE Table3.STATUS end as replace_regexpr FROM Table3 I get a Syntax is incorrect near """ error message. Do you know what the Problem could be?
– Mike B
Nov 13 at 9:05
I added a new expressions that you can use as a seperate column data in your code, I hope it helps
– Eralper
Nov 13 at 11:16
Again, thank you very much Eralper, Maybe I was not clear enough with my wording About the different Status entries. The do not only have this pattern like you assumed. Just to Name a few: Test [[with the ID 1237]] is done, Ticketnumber[[: 9G62J]], [[OE_1559C: ]]New RSKT.... in these examples the part that needs to be removed is marked in [] …. sorry for the missunderstanding and thanks again for your patients and help! Edit: I have about 20 different wordings that need to be harmonized
– Mike B
Nov 13 at 11:26
And as a result what do you want to see in the output? You can use " | " pipe sign to search for static text in status, but if you want to modify the output then maybe we should use place holders
– Eralper
Nov 13 at 11:59
Test [[with the ID 1237]] is done should be Test is done - Ticketnumber:9G62J should be Ticketnumber - OE_1559C: New RSKT should be New RSKT
– Mike B
Nov 13 at 12:09
|
show 3 more comments
up vote
0
down vote
accepted
@Mike, could you please try following SQLScript command
CREATE COLUMN TABLE Testsubject_status2 AS (
Select
Table1.Person AS "Person",
Table1.Vers AS "Vers",
Table2.Flnr AS "Flnr",
Table3.Status AS "Status",
REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr"
FROM
Table1, Table2, Table3
WHERE Table1.Person = Table2.Person
AND Table2.Flnr = Table3.Flnr
);
This will produce a table with following sample data
Note that the STATUS column is replaced with a static text if there is a match for the given condition. Else the STATUS text is kept as it is
For the additional info, I added following expressions but I did not like it much
Maybe there are better solutions
REPLACE_REGEXPR (
'(test with the id|Deployment for the ID) [[:digit:]]* is (done|completed)'
FLAG 'i'
IN Table3.STATUS
WITH
case
when Table3.STATUS LIKE_REGEXPR('test') Flag 'i' then 'test is done'
when Table3.STATUS LIKE_REGEXPR('deploy') Flag 'i' then 'deployment is done'
else Table3.STATUS
end
) as "replace_regexpr_ext"
You can add this add a new calculated column in your table definitions script
I assume you have following status text in your table data:
- Deployment for the ID 234 is completed
- Deploy development
Thank you very much Eralper, really! The Statement is finally working! As stated in the "additional Info" part of my post, I would need to replace other Strings like the "Test is done“ as well. If I put the REPLACE_REGEXPR Statement in a CASE WHEN Table3.Status like ‘test with the ID % is done’ then REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr" ELSE WHEN xxxxx ELSE WHEN xxx ELSE Table3.STATUS end as replace_regexpr FROM Table3 I get a Syntax is incorrect near """ error message. Do you know what the Problem could be?
– Mike B
Nov 13 at 9:05
I added a new expressions that you can use as a seperate column data in your code, I hope it helps
– Eralper
Nov 13 at 11:16
Again, thank you very much Eralper, Maybe I was not clear enough with my wording About the different Status entries. The do not only have this pattern like you assumed. Just to Name a few: Test [[with the ID 1237]] is done, Ticketnumber[[: 9G62J]], [[OE_1559C: ]]New RSKT.... in these examples the part that needs to be removed is marked in [] …. sorry for the missunderstanding and thanks again for your patients and help! Edit: I have about 20 different wordings that need to be harmonized
– Mike B
Nov 13 at 11:26
And as a result what do you want to see in the output? You can use " | " pipe sign to search for static text in status, but if you want to modify the output then maybe we should use place holders
– Eralper
Nov 13 at 11:59
Test [[with the ID 1237]] is done should be Test is done - Ticketnumber:9G62J should be Ticketnumber - OE_1559C: New RSKT should be New RSKT
– Mike B
Nov 13 at 12:09
|
show 3 more comments
up vote
0
down vote
accepted
up vote
0
down vote
accepted
@Mike, could you please try following SQLScript command
CREATE COLUMN TABLE Testsubject_status2 AS (
Select
Table1.Person AS "Person",
Table1.Vers AS "Vers",
Table2.Flnr AS "Flnr",
Table3.Status AS "Status",
REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr"
FROM
Table1, Table2, Table3
WHERE Table1.Person = Table2.Person
AND Table2.Flnr = Table3.Flnr
);
This will produce a table with following sample data
Note that the STATUS column is replaced with a static text if there is a match for the given condition. Else the STATUS text is kept as it is
For the additional info, I added following expressions but I did not like it much
Maybe there are better solutions
REPLACE_REGEXPR (
'(test with the id|Deployment for the ID) [[:digit:]]* is (done|completed)'
FLAG 'i'
IN Table3.STATUS
WITH
case
when Table3.STATUS LIKE_REGEXPR('test') Flag 'i' then 'test is done'
when Table3.STATUS LIKE_REGEXPR('deploy') Flag 'i' then 'deployment is done'
else Table3.STATUS
end
) as "replace_regexpr_ext"
You can add this add a new calculated column in your table definitions script
I assume you have following status text in your table data:
- Deployment for the ID 234 is completed
- Deploy development
@Mike, could you please try following SQLScript command
CREATE COLUMN TABLE Testsubject_status2 AS (
Select
Table1.Person AS "Person",
Table1.Vers AS "Vers",
Table2.Flnr AS "Flnr",
Table3.Status AS "Status",
REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr"
FROM
Table1, Table2, Table3
WHERE Table1.Person = Table2.Person
AND Table2.Flnr = Table3.Flnr
);
This will produce a table with following sample data
Note that the STATUS column is replaced with a static text if there is a match for the given condition. Else the STATUS text is kept as it is
For the additional info, I added following expressions but I did not like it much
Maybe there are better solutions
REPLACE_REGEXPR (
'(test with the id|Deployment for the ID) [[:digit:]]* is (done|completed)'
FLAG 'i'
IN Table3.STATUS
WITH
case
when Table3.STATUS LIKE_REGEXPR('test') Flag 'i' then 'test is done'
when Table3.STATUS LIKE_REGEXPR('deploy') Flag 'i' then 'deployment is done'
else Table3.STATUS
end
) as "replace_regexpr_ext"
You can add this add a new calculated column in your table definitions script
I assume you have following status text in your table data:
- Deployment for the ID 234 is completed
- Deploy development
edited Nov 13 at 11:15
answered Nov 13 at 6:43
Eralper
5,02511220
5,02511220
Thank you very much Eralper, really! The Statement is finally working! As stated in the "additional Info" part of my post, I would need to replace other Strings like the "Test is done“ as well. If I put the REPLACE_REGEXPR Statement in a CASE WHEN Table3.Status like ‘test with the ID % is done’ then REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr" ELSE WHEN xxxxx ELSE WHEN xxx ELSE Table3.STATUS end as replace_regexpr FROM Table3 I get a Syntax is incorrect near """ error message. Do you know what the Problem could be?
– Mike B
Nov 13 at 9:05
I added a new expressions that you can use as a seperate column data in your code, I hope it helps
– Eralper
Nov 13 at 11:16
Again, thank you very much Eralper, Maybe I was not clear enough with my wording About the different Status entries. The do not only have this pattern like you assumed. Just to Name a few: Test [[with the ID 1237]] is done, Ticketnumber[[: 9G62J]], [[OE_1559C: ]]New RSKT.... in these examples the part that needs to be removed is marked in [] …. sorry for the missunderstanding and thanks again for your patients and help! Edit: I have about 20 different wordings that need to be harmonized
– Mike B
Nov 13 at 11:26
And as a result what do you want to see in the output? You can use " | " pipe sign to search for static text in status, but if you want to modify the output then maybe we should use place holders
– Eralper
Nov 13 at 11:59
Test [[with the ID 1237]] is done should be Test is done - Ticketnumber:9G62J should be Ticketnumber - OE_1559C: New RSKT should be New RSKT
– Mike B
Nov 13 at 12:09
|
show 3 more comments
Thank you very much Eralper, really! The Statement is finally working! As stated in the "additional Info" part of my post, I would need to replace other Strings like the "Test is done“ as well. If I put the REPLACE_REGEXPR Statement in a CASE WHEN Table3.Status like ‘test with the ID % is done’ then REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr" ELSE WHEN xxxxx ELSE WHEN xxx ELSE Table3.STATUS end as replace_regexpr FROM Table3 I get a Syntax is incorrect near """ error message. Do you know what the Problem could be?
– Mike B
Nov 13 at 9:05
I added a new expressions that you can use as a seperate column data in your code, I hope it helps
– Eralper
Nov 13 at 11:16
Again, thank you very much Eralper, Maybe I was not clear enough with my wording About the different Status entries. The do not only have this pattern like you assumed. Just to Name a few: Test [[with the ID 1237]] is done, Ticketnumber[[: 9G62J]], [[OE_1559C: ]]New RSKT.... in these examples the part that needs to be removed is marked in [] …. sorry for the missunderstanding and thanks again for your patients and help! Edit: I have about 20 different wordings that need to be harmonized
– Mike B
Nov 13 at 11:26
And as a result what do you want to see in the output? You can use " | " pipe sign to search for static text in status, but if you want to modify the output then maybe we should use place holders
– Eralper
Nov 13 at 11:59
Test [[with the ID 1237]] is done should be Test is done - Ticketnumber:9G62J should be Ticketnumber - OE_1559C: New RSKT should be New RSKT
– Mike B
Nov 13 at 12:09
Thank you very much Eralper, really! The Statement is finally working! As stated in the "additional Info" part of my post, I would need to replace other Strings like the "Test is done“ as well. If I put the REPLACE_REGEXPR Statement in a CASE WHEN Table3.Status like ‘test with the ID % is done’ then REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr" ELSE WHEN xxxxx ELSE WHEN xxx ELSE Table3.STATUS end as replace_regexpr FROM Table3 I get a Syntax is incorrect near """ error message. Do you know what the Problem could be?
– Mike B
Nov 13 at 9:05
Thank you very much Eralper, really! The Statement is finally working! As stated in the "additional Info" part of my post, I would need to replace other Strings like the "Test is done“ as well. If I put the REPLACE_REGEXPR Statement in a CASE WHEN Table3.Status like ‘test with the ID % is done’ then REPLACE_REGEXPR ('test with the id [[:digit:]]* is done' FLAG 'i' IN Table3.STATUS WITH 'Test is done') "replace_regexpr" ELSE WHEN xxxxx ELSE WHEN xxx ELSE Table3.STATUS end as replace_regexpr FROM Table3 I get a Syntax is incorrect near """ error message. Do you know what the Problem could be?
– Mike B
Nov 13 at 9:05
I added a new expressions that you can use as a seperate column data in your code, I hope it helps
– Eralper
Nov 13 at 11:16
I added a new expressions that you can use as a seperate column data in your code, I hope it helps
– Eralper
Nov 13 at 11:16
Again, thank you very much Eralper, Maybe I was not clear enough with my wording About the different Status entries. The do not only have this pattern like you assumed. Just to Name a few: Test [[with the ID 1237]] is done, Ticketnumber[[: 9G62J]], [[OE_1559C: ]]New RSKT.... in these examples the part that needs to be removed is marked in [] …. sorry for the missunderstanding and thanks again for your patients and help! Edit: I have about 20 different wordings that need to be harmonized
– Mike B
Nov 13 at 11:26
Again, thank you very much Eralper, Maybe I was not clear enough with my wording About the different Status entries. The do not only have this pattern like you assumed. Just to Name a few: Test [[with the ID 1237]] is done, Ticketnumber[[: 9G62J]], [[OE_1559C: ]]New RSKT.... in these examples the part that needs to be removed is marked in [] …. sorry for the missunderstanding and thanks again for your patients and help! Edit: I have about 20 different wordings that need to be harmonized
– Mike B
Nov 13 at 11:26
And as a result what do you want to see in the output? You can use " | " pipe sign to search for static text in status, but if you want to modify the output then maybe we should use place holders
– Eralper
Nov 13 at 11:59
And as a result what do you want to see in the output? You can use " | " pipe sign to search for static text in status, but if you want to modify the output then maybe we should use place holders
– Eralper
Nov 13 at 11:59
Test [[with the ID 1237]] is done should be Test is done - Ticketnumber:9G62J should be Ticketnumber - OE_1559C: New RSKT should be New RSKT
– Mike B
Nov 13 at 12:09
Test [[with the ID 1237]] is done should be Test is done - Ticketnumber:9G62J should be Ticketnumber - OE_1559C: New RSKT should be New RSKT
– Mike B
Nov 13 at 12:09
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53260132%2fsql-sap-hana-replace-regexpr-in-column-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown