SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    grasshoppa Snowbird122's Avatar
    Join Date
    Apr 2001
    Location
    Austin
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    easy sql syntax question

    I have a DB table that I may want to add fields to in the future. How can I structure my insterts and updates so that adding fields wont break the queries?
    http://www.echo-consulting.net - Sound Solutions for Online Inspriations.

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the new fields are NOT NULL, or don't have a default value, your queries will break no matter what you do.

    That said, if your new fields can take NULL or default values, just remember to list the field list in your insert statements:
    Code:
    INSERT INTO table1 (field1, field2)
    VALUES ('value1', 'value2');
    And not like this:
    Code:
    INSERT INTO table1
    VALUES ('value1', 'value2');


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •