dbTalk Databases Forums  

Text Fields

comp.databases.mysql comp.databases.mysql


Discuss Text Fields in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe Hesse
 
Posts: n/a

Default Text Fields - 06-08-2011 , 07:28 AM






I am just getting started in using the "Text" type in MySQL.

Is the following INSERT the proper way to enter newlines in text data?

Is there a way to dump the contents of a text file into a text field?

Thank you,
Joe





mysql> describe Employees;

+--------+-------------+------+-----+---------+-------+
Quote:
Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
name | varchar(40) | NO | | NULL | |
report | text | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+

mysql> INSERT INTO Employees (name, report) VALUES('joe',
'Works hard\nGreat employee\nHire him');

mysql> select * from Employees;

+------+------------------------------------+
Quote:
name | report |
+------+------------------------------------+
joe | Works hard
Great employee
Hire him |
+------+------------------------------------+

Reply With Quote
  #2  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: Text Fields - 06-08-2011 , 07:32 AM






Joe Hesse wrote:
Quote:
I am just getting started in using the "Text" type in MySQL.

Is the following INSERT the proper way to enter newlines in text data?

its one way for sure.
Quote:
Is there a way to dump the contents of a text file into a text field?

Try LOAD FILE.



Quote:
Thank you,
Joe





mysql> describe Employees;

+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| name | varchar(40) | NO | | NULL | |
| report | text | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+

mysql> INSERT INTO Employees (name, report) VALUES('joe',
'Works hard\nGreat employee\nHire him');

mysql> select * from Employees;

+------+------------------------------------+
| name | report |
+------+------------------------------------+
| joe | Works hard
Great employee
Hire him |
+------+------------------------------------+

Reply With Quote
  #3  
Old   
Axel Schwenke
 
Posts: n/a

Default Re: Text Fields - 06-08-2011 , 07:46 AM



Joe Hesse <JoeHesse (AT) gmail (DOT) com> wrote:

Quote:
Is the following INSERT the proper way to enter newlines in text data?
RTFM!

http://dev.mysql.com/doc/refman/5.1/...ng-syntax.html

Quote:
Is there a way to dump the contents of a text file into a text field?
RTFM!

http://dev.mysql.com/doc/refman/5.1/...tion_load-file


XL

Reply With Quote
  #4  
Old   
Joe Hesse
 
Posts: n/a

Default Re: Text Fields - 06-08-2011 , 07:57 AM



On Wed, 08 Jun 2011 14:46:57 +0200, Axel Schwenke wrote:

Quote:
Joe Hesse <JoeHesse (AT) gmail (DOT) com> wrote:

Is the following INSERT the proper way to enter newlines in text data?

RTFM!

http://dev.mysql.com/doc/refman/5.1/...ng-syntax.html

Is there a way to dump the contents of a text file into a text field?

RTFM!

http://dev.mysql.com/doc/refman/5.1/en/string-
functions.html#function_load-file


XL
Thank you. I probably deserved the RTFM but I couldn't determine what
would work with TEXT fields. Your links will help me.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.