Questions tagged [replace]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

Replace part of a string in MYSQL, when only the substring's starting characters, ending characters & a unique string in the middle is known?

I'm trying to find a way to replace part of a string in a database without knowing the exact substring content other than how it starts, ends and has a specific ID string somewhere in between that. ...
0
votes
2answers
30 views

mysql > why replace command is not working on strings coming from json encoded?

Say in my wordpress db I've got a post_content column containing strings like this: href=\"http:\/\/dev.example.com\/example\/wp-content\/uploads\/2019\/07\/my.pdf\" The above is a portion of string ...
0
votes
1answer
28 views

REPLACE(orig,match,replacement) multiple matches in one query

I'm trying to categorize Magic The Gathering cards. Here is a simplified version of what I'm doing/trying. Is it reasonable/doable to get my desired output from mysql? If so, how? Or am I going to ...
0
votes
0answers
26 views

phpmyadmin “find and replace” shows only first 17 columns

I would like to use phpmyadmin's "Find and replace" function, but it shows only the first 17 columns (out of the 61 in that table's structure); the column I want to use is past the first 17 columns. ...
0
votes
1answer
82 views

Cleaning up bad data with REGEXP_REPLACE too aggressive with non latin chars

Trying to use REGEXP_REPLACE to cleanup a text field in a table. Here's my query: select title original ,REGEXP_REPLACE(title, '[^a-zA-Z0-9]+', ' ') clean from tmp_table2 WHERE txn_title like '%?%' ...
3
votes
1answer
50 views

PostgreSQL 11: Replace function body by users from the same group

In the documentation of CREATE FUNCTION is stated that ''You must own the function to replace it (this includes being a member of the owning role).'' Two questions: I don't understand what exactly ...
-1
votes
1answer
49 views

Replace NULLs with value

Here is my temporary table: CREATE TABLE #test123( c1 float, c2 float, c3 float, c4 float, c5 float ); INSERT #test123(c1,c2,c3,c4,c5) VALUES (2,3,NULL,1,2), (2,NULL,NULL,...
-2
votes
1answer
337 views

msSQL: How do I replace NA values in different columns by different values?

Here is a example of a table: ID Value1 Value2 Value3 ----------------------------------------------------- 1 1 2 NA 2 NA ...
1
vote
1answer
19 views

Remove text from columns that may or may not be present multiple times

I have the following table in SQL Server 2008. create table OrgUnits ( OrgUnitId int not null constraint PK_OrgUnits1 primary key, OrgUnitName varchar(100), OrgUnitLevel int not null, ...
2
votes
1answer
49 views

find 16,000 words and replace with ##

I need to do a find a replace but rather than find one word to replace with another I have about 16k words, so as an example; table 1 has two words apple,orange - table 2 has the contents of a book, i ...
0
votes
1answer
296 views

MYSQL REPLACE string content with field value

How can I REPLACE a string value with a other field content? SELECT REPLACE(html_input,'!value',field_value) FROM table Value of html_input is <input type='text' value='!value'> Value of ...
3
votes
1answer
1k views

Replace all Numeric Values with Single Character

I have a value in a SQL table like the below: 80400365_SwapOpenTrd_20180831.csv I want to replace the numeric values so it is returned as this: %_SwapOpenTrd_%.csv I tried the below code but there ...
2
votes
1answer
9k views

How to remove specific characters from strings in sql

I've got a table with a column. I want to change a part of some strings in the column. Input 6|Drivers Manuals BH-EB531 TRST-BACMN- Desired output Drivers Manuals BH-EB531 TRST-BACMN Below ...
1
vote
2answers
1k views

TSQL Remove Characters from Text Value

I have been using the REPLACE function to remove characters from a text value in a table. It has just grown over time and now the query is quite messy. What can I do to make this more efficient? Is ...
0
votes
0answers
207 views

nText and String manipulation. SQL SERVER

Parent question - Thanks to Paul White and Tom V for answer. I am making little modification's to Paul White's answer to suit my requirements. I would like to change the following to replace a ...
0
votes
2answers
323 views

Converting from char(26) to datetime2

In course of a change I migrated a database from Oracle 12.1 to MSSQL 2016. Since the two databases handle date differently, I now need to move the fields from char(26) to datetime2. Output format is ...
0
votes
1answer
1k views

performance of Replace vs If exists update else insert vs update if row_count()=0 insert

Structure of my table is: Id int(11) NO PRI auto_increment Mobile varchar(10) NO LoanAmount int(11) NO I want to UPDATE if existing ...
3
votes
1answer
2k views

How do I swap tables atomically in Oracle?

How to do I swap two tables in an atomic fashion in Oracle? I would like to perform the equivalent of: ALTER TABLE foo RENAME foo_tmp; ALTER TABLE foo_new RENAME foo; but what happens if a query ...
4
votes
4answers
4k views

Multiple string replacements

I've got a replacement map table CREATE TABLE #ReplacementMap (old NVARCHAR(10), new NVARCHAR(10)) INSERT INTO #ReplacementMap VALUES ('A',5) INSERT INTO #ReplacementMap VALUES ('C',9) INSERT INTO #...
0
votes
2answers
49 views

Remove characters from recordset permanently

I have some data in this format: 52-681-Functional-EHT 53-682-Functional-EGT 52-683-Functional-EZT 51-684-Functional-EYT 59-685-Functional-E5T And I want to remove the interior '-Functional' ...
1
vote
2answers
216 views

Replacing MYSQL table with data from another table - no downtime

I have two tables with identical structures: Table1 and Table2 id INT PRIMARY KEY, a TINYINT, b TINYINT, c TINYINT Table1 is actively being used by queries from other sessions; Table2 is not ...
1
vote
1answer
622 views

Oracle Unknown Character

I have a script, UPPER(REPLACE(REPLACE(REPLACE(REGEXP_REPLACE(TRIM(mbr.mbr_first_name) || ' ' || TRIM(mbr.mbr_last_name), '[-+"=;:,<>?\/.~`!@#$%^&*()_\-|{}[]]*',''), CHR(9), ' '), CHR(10), ...
7
votes
3answers
50k views

SQL Server: Replace with wildcards?

Does Microsoft SQL Server natively support some sort of replace function using wild cards? I gather that Regular Expressions are not available natively. I note that there is a PATINDEX function which ...
0
votes
1answer
2k views

Replace special character

I am trying to replace the character ' with the character ", using: UPDATE posts SET text = replace(text, ''', '"'); but: 1 errors were found during analysis. Ending quote ' was expected. (near ...
0
votes
2answers
3k views

How to combine “SELECT” and “REPLACE INTO” when combining two MySQL tables into another?

I've got data with measurements split between two different tables, but the data doesn't need to be present in both: mysql> SELECT * FROM t1; mysql> SELECT * FROM t2; +----------------...
2
votes
1answer
735 views

Oracle, how to manually re-instantiate a PL/SQL package?

I have a web application which calls a procedure from an Oracle PL/SQL package. Each time the package is replaced in turn of a new release the application runs into an exception ORA-06508 java.sql....
-2
votes
1answer
146 views

Pattern matching and replacement in oracle

So we have a table called TEMPLATES that stores html email templates as plain text (don't ask, I wasn't around when that decision was made). There are a number of columns in this table but the one we ...
1
vote
3answers
728 views

How to speed up string cleanup function?

I need to cleanup a string, so that certain ASCII code characters are left out of the string, and others are replaced. I am new to Postgres. My function ufn_cie_easy() performs way too slow: DECLARE ...
2
votes
1answer
48 views

Replacing double digit numbers

I have column with numeric values that I need to replace into text values. I used the sql statement: REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(...
2
votes
1answer
17k views

regexp_replace() vs. replace() to replace all matches in a string

By default, in PostgreSQL, regexp_replace() replaces the first occurrence of a substring in a string, while replace() replaces all occurrences of a substring in a string. Why is the default behavior ...
2
votes
1answer
54 views

Search and Replace in multiple MySQL databases

I have multiple MySQL databases(50+) and I want to replace a string in all of them, is there anyway to search and replace in all the databases? Server is CentOS and I have SSH root access.
10
votes
3answers
87k views

Replace special characters in a column with space

I'm trying to write a query which replaces the special characters with space. Below code helps to identify the rows. (alpha-numeric characters, comma and space is valid): SELECT columnA FROM tableA ...
0
votes
1answer
46 views

Remove all instances of a character from a column within tag

I don't know much about writing SQL and a client of mine has an erroneous semicolon appearing in his database that he'd like removed. It's in 1 specific column, but it should only be removed if it is ...
0
votes
1answer
112 views

Procedure to replace a BDR server

I have set up a 2-node PG 9.4 system with BDR. Replication works great. Now, let's suppose that one of the two nodes needs to be replaced. In fact, let's be more specific. Let's say that the node on ...
0
votes
2answers
2k views

Replace a specific part of a string

I have many strings in the database like: <iframe src="https://www.youtube.com/embed/-qTiYA1WiY8&index=8&list=PLPNcLSfYNC3Dw535smncyHRCBRmdf1Bti" frameborder="0" allowfullscreen><...
1
vote
1answer
5k views

Find and Replace text in all table using mysql query

I have a database with name test having two tables sample1(name, quote) sample2(name, quote) I need a replace function or procedure that does the following Find columns with String data type (Text,...
3
votes
2answers
5k views

How to split numbers and text in MySQL

I have searched over the internet looking for a function like REGEXP_REPLACE in Oracle, regexp_replace in PostgresSQL but I haven't find one similar in MySQL just REGEXP and RLIKE, but these operators ...
1
vote
1answer
628 views

mysql how to replace a column content

I using Mysql. Table: Content_T1 id : int title : varchar255 content: text my all page content will be save in content columns. mysql content column... there is some <img src="http://abc....
3
votes
1answer
13k views

Mysql REPLACE INTO query for Multiple rows insertion

I'm trying to add multiple rows using 'replace into' , but its updating one row. REPLACE INTO user_balance (user_id,acc_type,currency,balance,enable_deposit, enable_withdrawal,pending_balance,...
1
vote
3answers
3k views

REPLACE INTO SELECT from table

Is there a way in DB2 to replace the entire table with just selected rows from the same table ? Something like REPLACE into tableName select * from tableName where col1='a'; (I can export the ...
1
vote
1answer
132 views

(MySQL) Need an “in-place” REPLACE for adjusting historical data

I have a table with around 6,000,000 records. It is backed up every few hours. Recently a script ran that cascade updated about 2,000,000 of the older records to bad values. I have extracted those ...
3
votes
1answer
2k views

postgresql replace table without losing dependancies

i want to replace an existing table with a new one, without losing foreign keys or inheritance relations. But I feel lazy to alter it to make it look like the new one. Is there a way to replace the ...
1
vote
2answers
986 views

Removing apostrophe in result set

create view ENTRP_SERVS.V_IRS_BULK as Select Atr.Ssn_Tx ,Names.First_Na ,Names.Middle_Na ,Names.Last_Na ,Reff.Ref_Cd_Desc_Tx Suffix_Na ,MBR.PRSN_MBRSH_ID, T_PRSN_MBRSH_TAX.FILTER_TYPE_CD From Hix....
1
vote
1answer
4k views

Remove single quotes from db2 column name

I have following query which i am trying to execute against db2 database server SELECT REPLACE('\'abc\'','\'','') FROM TN_DAY_PROCESS I am expecting the output like abc without single quotes from ...
-1
votes
1answer
69 views

Replace minus symbol across whole document [closed]

A program I use has SQL & RTF files to generate reports and I'm wanting to remove all instances of the - (minus) symbol from the resulting document. I'd tried a SELECT REPLACE but I'm not very ...
1
vote
1answer
5k views

UPDATE SET REPLACE() matches but does not change

I've seen another post about this exact thing but it's 1-1/2 years old so I thought I'd make my own...besides, the other post did not help me. What I am trying to do is pretty straight-forward. To ...
1
vote
1answer
7k views

Need to replace only first occurrence of string

I hope I worded the question right. Here are the specifics: This is regarding a MySQL database. I've inherited several hundred posts with custom fields and a unique excerpt. At this point I think I ...
3
votes
2answers
11k views

Remove the last character from Variable String

I have a few variable data in the column "email". For example: roy2087@gmail.com123 sg123@yahoo.compori How do I get rid of the characters after .com? I used Replace(email,'.com%',gmail.com), ...
1
vote
1answer
144 views

Query to change all field in a given mysql table?

I have a table with a timestamp field called "time". I have many records in this table and "time" has value like: 1343296642, 1343308689... I need to run a query to subtract 2 years of time to those ...
2
votes
1answer
13k views

Query to find and replace text in all tables and fields of a mysql db

I need to run a query to find and replace some text in all tables of a mysql database. I found this query, but it only looks for the text in the tbl_name table and just in the column field. update ...