SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: SQL Problem

  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Mississippi
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL Problem

    Okay, I've been looking at this and looking at this. All my field names are correct to let you know. Does anyone see why I am getting a syntax error in update statement with this sql:
    Code:
    update classDesc set courseName='Test 101', desc='This is a test. This is only a test.' where courseNo='TST 1111'
    Derrick
    Creativity is great, but plagiarism is faster!

  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)
    'desc' is a reserved word (it's used for sort order)

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Mississippi
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GAH! I knew that! I feel so stupid now! Thanks man.
    Derrick
    Creativity is great, but plagiarism is faster!

  4. #4
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I've mentioned before (and more recently in this thread), using reserved words isn't necessarily a problem. Just surround each table or field name in your SQL statement with square brackets []...

    Code:
    UPDATE [classDesc] SET [courseName]='Test 101', [desc]='This is a test. This is only a test.' WHERE [courseNo]='TST 1111'
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


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
  •