SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Feb 2006
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Updating only the current row in the database

    Hi friends,
    I searched in the forum, but didn't find any topic for this.

    I want to write the results of execution back to database.
    But I just want to update the current row.
    Can anybody suggest me some solutions?
    I can't use any field value in the update criteria as there can be more than one rows with same value.
    My table is not having any primary key.

    Thanks in advance...
    Cheers,
    Amol

  2. #2
    Senior Member
    Join Date
    Oct 2002
    Location
    England
    Posts
    368
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Updating only the current row in the database

    Add a identity column to the table and use that. If you stop and think about that for a minute, what you're actually doing will be to add a primary key - albeit without explicitly defining one.

    Amend your script to return the identity column value and add a 'WHERE identity_col = current row identy column value' clause to your UPDATE statement. Consult your DBMS help text for details on how to work with identity columns.

    Regards
    Peat

  3. #3
    Senior Member
    Join Date
    Dec 2001
    Location
    Boston,MA, USA
    Posts
    162
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Updating only the current row in the database

    Can you define "current row"?

    If there is a defined position of this record in the recordset, as in first, last etc you should be able to go to it and only update that one.

    At any rate, what kind of database is this which does not have a unique row identifier? surely not a RDBMS!
    -Shree

    *************************************************
    The more I learn, the more I realize how little I know!

  4. #4
    Member
    Join Date
    Feb 2006
    Posts
    47
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Updating only the current row in the database

    Thanks Peat & Shreev.

    Peat currently I am using the same i.e. I have added one column for row no and using it.
    Cheers,
    Amol

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:08 PM.

Copyright BetaSoft Inc.