Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Removing Quotation Marks


Say you had a column with character data that contained quotation marks. How would you update this column to remove the quotation marks? update table set description = replace(description, 'xx', 'xx') but instead of the x's replace quotations " with nothing since you cant put the quotes directly into the first parameter of the replace function?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Use Quotation Marks In Insert Into Command String?
how to make SQL command with cuotation marks for example
INSERT INTO some_table (name, pet) VALUES ( ' Petar's ' , ' dog ')
is there any way to put quotation marks inside the string, or should I make some statements for chechking if the string has quotes and replace them????

MySQL Is Adding Quotation Marks When Uploading Tab-delin. .txt File
In the Excel sheet, the data looks like:

Data that is going into a page.

and is coming out

"Data that is going into a page."

It doesn't seem to be causing errors, but the formatting looks like crap.

Inserting A String Containg Quotation Character
I was encrypting a string and inserted it to mysql db, when displaying the encrypted string, it has no quotation character but when I inserted it to my db, I got an error using near "xxxx' where xxxx is of any character. I use VB code. it has no effect when using replace command.

Apostrophes Turning Into Question Marks?
This may be easily resolved but I haven't ever encountered it before. I am entering text into my mysql database that contains apostrophes. This field is generally around 500-800 characters. When I add the information, there are apostrophes but when I go back to use the information, all of the apostrophes have been changed into question marks.
Any ideas how to keep the apostrophes? or why they are being changed?
Also, if I go through and change all the question marks back to apostrophes, they will stay apostrophes!


Double Quote Marks In SQL Backup File
when I do a backup of a table on my mySQL Administrator I get CREATE TABLE "product" (double quotes), I want product` (single quote marks) where do I specify this I tried all I can imagine already to do with character set..and backup options
(this messes up on restore with double quotes on DB I need to add this to..

String Error - Quotes Changed To Question Marks
I recently converted an asp/access site to an asp/mysql site. Now all my strings are displaying funky. For example if I have the text - Why don't we say "Yipee" - it displays on my site as - Why don?t we say ?Yipee?. The same change is being made when I use a sentence with "..." in it. I like ... baseball is changed to - I like?baseball.

Any thoughts as to why this is happening? Sometimes it is actually being changed somehow in the database, and sometimes it is correct in the database, but then changed when it displays on the web.

Removing Mysqld-net.exe
Recently I removed MySQL 4.0.15 from my pc, but have noticed that a process called 'mysqld-nt.exe' is still running in the task manager. I have tried shutting down and uninstalling the service via the command line, but since the mysql directory no longer exists the system reports there is nothing to remove!

Should I re-install mysql 4.0.15 and try un-installing it again, or does anyone know a quicker way to fix this problem?

Removing Old Items
I have a mysql table that stores temporary session items, but I don't want the table to get huge. What would be the best way to automatically delete old items that aren't being used anymore? I could use a timestamp, but this will only be good through the year 2038. I don't want this function to stop working 32 years from now. Any suggestions?

Removing A Domain
I added a new domain but by mistake i inserted an incorect username from what the client wants. how can i change it, or remove the user and redo it.

Removing Users
I can't seem to figure out how to remove users with php. I tried to do it with this
$query = mysql_query("REVOKE ALL PRIVILEGES, GRANT OPTION FROM user");

Where user is the name of the user I want to delete. That's what it said to do in the GRANT/REVOKE syntax part of the site but it doesnt do anything when I run the script.

Removing Duplicates
I am trying to remove all the duplicates in a large table. I found the post on here regarding finding duplicates which gave the following SQL query

SELECT Domain_Name, Count(Someotherfield) AS CountOfEntry
FROM Domain
GROUP BY Domain_name
HAVING (((Count(Someotherfield))>1));

Removing Old Versions
I loaded a new version of Mandrake Linux 10.0 CE and have also installed and dowloaded a new version of MySQL 4. I'm not sure but think I have several versions installed and running ...

How can I check to see what is installed, what is currently running, and then perhaps remove them all and start by installing single new copy?

Removing MySQL
How do I remove MySQL from a MAC running OS X 10.4?

Removing A Record
Is it possible to remove a record from a webpage. What i want to do is on the last page, delte the record i have built up with inserts and updates.

Removing Spaces
I've got a MySQL database where a silly user input a whole bunch of records with spaces at the end.Is there an easy way to get rid of those spaces without having to re-input the records again?

Removing Subqueries
the query i want execute is:

select email from avalia where email in (select * from avalia where nome=´img/im1.jpg´) and email in (select * from avalia where nome=´img/im2.jpg´)

but mysql 4.0 don't acept subqueries.

Removing Duplicates
I have a table with about 50,000 entries.
Is there an easy way to remove all the duplicate entries?
I could go through the entire table one at a time, select the field then delete from the table where it equals that field and then re-insert it back in to the table.
Is there any easier way to do it?

Removing Fields
Is there anyway to delete all the rows that have a certain field with less than say 5 characters from a table?
I have a table with entries that are like "efg" or something that don't make sense. I need to get rid of all of them.

Removing Rows
I'm trying to find out how I can remove certain rows of a particular table after, for example, half an hour. The table includes a timedate field for this purpose.

Does MySQL(4.1.13) include anyway of doing this, or will I need to create some sort of "house cleaning" program and scedule it in the opperating system?

Edited 1 time(s). Last edit at 03/08/2006 09:23AM by Phil Couling.

Removing End-of-lines
I have a field in a table that I need to scan through and remove all end-of-line chars excepts for an end-of-line that is immediatly follwed by an end-of-line. Does this make sense?

Removing Emails
I have a master table list of emails (masterlist). I have a second table (removelist) with emails that I want removed from the master table list.I have tried.Code:

DELETE FROM
masterlist WHERE email IN
(SELECT email FROM removelist)

but get

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT email FROM removelist)' at line 1

Removing AUTO_INCREMENT
I need to remove the auto_increment directive from a table, but so far I'm not having any luck.
I tried alot of variations on ALTER TABLE/MODIFY but I get errors.
I could dump the table, remove the auto_increment from the CREATE query, DROP the table and reload, but I'd rather know how to do it right than use a stupid work-around.

Removing Duplicates With Unique IDs?
I searched around and found a few threads similar to my problem, but I wasn't able to find a very clear answer to this question.
Basically I have a huge database (8.2 m records) full of destinations, things like restaurants, hotels, etc, and there are a lot of duplicates. The duplicates are in the database from the source, and we cannot change that.
Some duplicates actually have up to 3 columns that are different. The ID is unique for each row, and the category number can be different as well. I've even seen a couple instances where the zip code does not have the leading zero. Here are some example rows:
ID_____NAME_____ADDRESS_____CITY_____STATE_____ZIP_____CAT
544 WAL-MART 1234 MAIN ST DALLAS TX 05424 1234
545 WAL-MART 1234 MAIN ST DALLAS TX 5424 4321
546 WAL-MART 1234 MAIN ST DALLAS TX 05424 1234
The reason why these duplicates exist (probably) is because one WAL-MART could fit into multiple categories, because it's a grocery store, a department store, a photo center, etc. I don't want all that junk, I just want 1 record for 1 Wal-Mart
How could I go about deleting these duplicate records? and if possible, I'd like to be able to choose which record is kept, based on the category ID.

Removing Duplicates With Unique IDs?
I searched around and found a few threads similar to my problem, but I wasn't able to find a very clear answer to this question.

Basically I have a huge database (8.2 m records) full of destinations, things like restaurants, hotels, etc, and there are a lot of duplicates. The duplicates are in the database from the source, and we cannot change that.

Some duplicates actually have up to 3 columns that are different. The ID is unique for each row, and the category number can be different as well. I've even seen a couple instances where the zip code does not have the leading zero. Here are some example rows:

ID_____NAME_____ADDRESS_____CITY_____STATE_____ZIP_____CAT
544 WAL-MART 1234 MAIN ST DALLAS TX 05424 1234
545 WAL-MART 1234 MAIN ST DALLAS TX 5424 4321
546 WAL-MART 1234 MAIN ST DALLAS TX 05424 1234

The reason why these duplicates exist (probably) is because one WAL-MART could fit into multiple categories, because it's a grocery store, a department store, a photo center, etc. I don't want all that junk, I just want 1 record for 1 Wal-Mart

How could I go about deleting these duplicate records? and if possible, I'd like to be able to choose which record is kept, based on the category ID.

Removing Space In Varchar
i have a problem to make a transtype

from field XX varchar(20), example :
19 200 340,56

to field YY integer, required :
19200340

I make two replace
- first for replacing the , by a .
- second for replacing the space by '' (nothing)

and a cast :

insert into table2
select cast(replace(replace(XX,',','.'),' ','') as unsigned) from table
1 ;

The problem is the first replace. The space is not recognized. Even for
example with others commands related to string. If I put any other
caracter, it works. Does anyone have any solution ?

Removing All The Default Stopwords
How do you remove all the default stopwords in mySQL 5.0 so that the full-text indexing does not block any words?

Removing Line Feeds
I have a MySQL database where some of the fields contain line feeds which screws up the data when I export it. I can write scripts to get round this but I wondered if there was an easy way to fix the data at source. My table has 51 fields and 175,000 rows.

Removing Old, Unused Tables...
can i execute some kind of script on phpmyadmin that will drop any tables that havent been accessed in a certain amount of time?

Removing MySql 4.1.3 From Tiger OSX
I have made a mess of setting up my MySQL, I would like to remove it and reinstall it. I have found a tutorial that explains how to go through the removal of the database but the my database will not let me do the first stage which is to shut down the server.

andrew-cetnarskyjs-powerbook-g4-15:~ andrewcetnarskyj$ sudo mysqladmin -u root -p shutdown
sudo: mysqladmin: command not found

Removing Duplicates With Group By
If I use Group by on one field that I don't want duplicated in my resultset, I get the desired results but I am not confident that this is a bona fide way of doing things.

I've tried using DISTINCT and DISTINCTROW but they don't work, at least not the way I have been using them.

I want to remove duplicates of a particular Course Reg Number (CRN). MY query looks something like

SELECT * FROM table1 WHERE ... GROUP BY crn

like I said I get the desired results just not sure.

Removing Empty Fields
I have an application that splits up blocks of text into sentences based on punctuation, and sometimes, like if a user types in "I'm so stoked!!" those two "!"s get turned into empty parts of the array. I'd just like to run a little command at the end of my storage page that deletes all the empty fields in the db, that way maintenence is happening while it's being used rather than having to run a seperate script to maintain the db.
So far I have:
$query = "SELECT * FROM sentences WHERE sentence IS NULL";
code...

Removing MySql Data
I saw the post by The Only One but found a much better tutorial. I have the code to remove the data:

DELETE FROM testfield WHERE id='$id'

Does this only delete the user with that ID or can I make it search for a user name and remove that? Would it be:

DELETE FROM testfield WHERE username='joe blogs'

Removing Auto-increment
I would like to change one of the fields (primary key field) in my table to not auto-increment. The table is still empty. Can I do this without having to drop the table and recreate it again?

Removing Double Quotes
I have a text file of the following format
CODE1211|d|"http:www.abc.com"
1211|d|"http:www.abc.com"
1211|d|"http:www.abc.com"
1211|d|"http:www.abc.com"

Removing Duplicate Records
I received a table from a third party that should be primary keyed on a column called item_id. But that column has four rows that are duplicated, including item_id. I would like to remove one of each of the duplicate rows, leaving the other row intact.
MYSQLBrowser won't let me create a primary key until this is solved.

Removing MySQL Stopword
Does anyone of you know how I would be able to remove (I have full root server access) the stopword list in mySQL for fulltext searches and set the minimum word length to 1?

I tried that way:

* adding that code to my.cnf in /etc:
"
ft_min_word_len=1
ft_stopword_file=""
"
* restarting mySQL over WHM/Cpanel
* redoing the fulltext indexes

but that didn´t give any effect.
Does anyone of you know a way how to?

Removing Trailing Spaces
I am importing data from a "csv" file that contains some trailing whitespace as well as
.. Problem is, when I import it those trailing spaces get includes in the records.
The field in question is a varchar and I read varchar is supposed to remove the trailing spaces)with my version of mySQL), but it doesn't.
I am importing using this method:
LOAD DATA INFILE 'xyz.csv' INTO TABLE MyData FIELDS TERMINATED BY '|' LINES TERMINATED BY '
' IGNORE 1 LINES;

Any mySQL solution to keep those trailing spaces out? I wrote a php script to do it but it takes a long time with all the data I import each day.

Removing Text Between Php Tags
I have a text field with the significant portion of my site content in it. Another developer has mixed php code into the database with the html and the whole lot is later excecuted using php's eval function.
I would like to build a search function for this column ( preferably using MATCH ... AGAINST & and a full text index ) but absolutely do not want the php code being searched or being returned in the results.

MYSQL - Removing Duplicated Rows
How do I delete DUPLICATE ROWS from my MYSQL Database?

I have a large number of rows that have been duplicated. Obviously I only need 1 of each.

Example:

[RPO_CODES] [DESCRIPTION]

Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package

I want to do this simply with SQL Query. I was told DISTINT would work?

Removing Year From CURDATE Or TO_DAYS
I'm trying to have a "today in history" page built with records pulled from a mysql table, and I just realized why it's not working... the year. I've read other threads here ("list birthdays in next 7 days", etc.) that point toward removing the year, but they also go by "DAYOFYEAR" in the cases I've found.

Here's the query I have now, which works if the years matchup:

SELECT DATE_FORMAT(`gamedate`, '%Y') as `gamedate`, location, opponent_id, oppname, result, score1, score2
FROM games, opponent
WHERE games.opponent_id = opponent.oppid AND TO_DAYS(CURDATE()) = TO_DAYS(`gamedate`)");
I've tried putting in a " - year " as I've noticed done on the other threads, but am getting nowhere.

Removing Html Tags & Contents
does anybody know of any available code that will remove html tags and their contents from a field within a SQL query?

For example on the following I would want to remove the tags leaving "Hello - this is a test this is a test this is a test this is a test this is a test"

"Hello - this a test <A href="test.html">click here</a> this is a test this is a test <script language=javascript>go</script> this is a test this is a test"

Windows SQL Services And Removing MySQL
I had installed mySQL when a programmer wanted to use it for a project. Then i uninstalled it. Now the MS SQL services (SQLserver, sql server activation directory helper, sql server browser, and sql server vss writer), cannot be started. The error messages seem to indicate that there are some files missing in order to run the services. I tried to re-install MySQL, but not it is giving me error zero when i run the configurator.

Removing Duplicate Rows In Table
Any way to remove duplicate rows in a database. I have like 225k rows in one table. Well there must be like 30k in duplicate rows. How would I get rid of them?  I thought about using distinct and putting the results in a table then just deleting the other table. Any info?

Removing Data After A Certain Period Of Time
What I want to do is run a query that inserts data into my database, but removes itself on a set date. Is there any way to do this?

Basically, I have something like this:

INSERT INTO table (blah, blah2) VALUES (blah blah, 1)

I would like to do something like:

INSERT INTO table (blah, blah2) VALUES (blah blah, 1) {{{ INSERT CODE TO MAKE VALUES GO AWAY WHEN CURRENT TIME = SET TIME TO GO AWAY }}}

There is an alternative to this if I have to. This is all for a PHP script, and instead of having MySQL automatically remove the data, I could add a time to remove to the table, insert the value for it in the INSERT query, and run a query on the index page consisting of something like

<?php
$timeToRemove = SELECT_TIME_TO_REMOVE_FROM_DB;
if($currentTime => $timeToRemove)
{
REMOVE;
}
?>

so that every time someone hit the index page, it checks if it is time to remove the values from the DB and if it is, it does so. But of course, that adds an extra query/queries, and I'd like to avoid that.

Edit: It may be useful to note that this is for a message board system, and I am dealing with making usergroup changes temporary. So instead of removing the values, perhaps it would be more useful if I could simply have MySQL reverse itself after a certain time has passed.

But that seems unrealistic for some reason now that I think about it, so the alternative may be my best choice. Any suggestions from you all would be nice as well, if you've any ideas.

Removing Character From Title Field
I have a photo album with close to two thousand photos in it. The title field of the database imported the file name of the photos, so each individual photo has a title like "my_photo_title".

I'd like to strip out the underscores from each of the title field and replace them with a space, but I have no idea how to go about doing that. I've done some searches, but the docs on this site is so huge, it's tough to track it down.

MYSQL - Removing Duplicated Rows
How do I delete DUPLICATE ROWS from my MYSQL Database? I have a large number of rows that have been duplicated. Obviously I only need 1 of each. Example:

[RPO_CODES] [DESCRIPTION]

Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package
Z28 Performance Package

I want to do this simply with SQL Query. I was told DISTINT would work?

Removing Rad-Only Trait From MySQL Table
It seems that one of my MySQL table has ben set to read only. I've been searching around, looking for a way to rememdy this, and I haven't found a whole of answers, just a bunch of folks asking the same question.

Anyone know how to switch the permission away from read-only?

Removing Ibdata1 And Log Files Safely
Our internal server is running low on disk space and we need to clean the root file system. I noticed the following MySQL files are growing larger. Is there a way to zero or delete them without corrupting the databases?

Is it safe to shutdown MySQL, delete ib_logfile0, ib_logfile1 and ibdata1 and then restart?

# pwd
/usr/local/mysql_5.0.16/data
#
# ls -l
total 41050
-rw-rw---- 1 mysql mysql 5242880 Oct 3 12:51 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 Dec 9 2005 ib_logfile1
-rw-rw---- 1 mysql mysql 10485760 Oct 3 12:51 ibdata1

We only use MyISAM tables, not innoDB. I am not sure if the tables will get corrupted if the log files are removed?

Removing Blank Tabs In Rows
Some of my earlier rows (Database is about 360mb) have blank tabs between text, i can I modify each row and delete the tabs so the size is smaller? I searched php manual didn't find a helpful function, maybe someone else has done this?


Copyright © 2005-08 www.BigResource.com, All rights reserved