Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum length of INSERT... string in .sql file

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

If you use code in the style of
Code:
INSERT INTO 'tablename' ('TOWN','COUNTY','POSTCODE') VALUES
[tab]('Arundel',West Sussex','AR'),
[tab]('Stroud','Glos','GL'),
[tab]...
[tab]...
[tab]('Wells','Somerset','WE');
in a .sql file to populate a table, what limits are there, if any, on the length of the string and therefore the number of records that can be inserted?

TIA


FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
There's no limit. That's exactly the format used by mysqldump to dump whole databases.
 
Correction, it's not "exactly the format ...". Those quotes around table and field names should be replaced with `backticks`.
 
Backticks allow the use of not quite acceptable table/field names. ie the use of reserved words like DATE.

Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
If I understand it correctly now backticks would only be used to surround table and field names?
Code:
INSERT INTO `tablename` (`TOWN`,`COUNTY`,`POSTCODE`) VALUES
    ('Arundel',West Sussex','AR'),
    ('Stroud','Glos','GL'),
    ...
    ...
    ('Wells','Somerset','WE');
TIA

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
Correct, and they're only needed if the name would be illegal otherwise. In the example given, they're not needed at all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top