Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. update special row

update special row

Scheduled Pinned Locked Moved Database
databasehelptutorialannouncement
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sara setare
    wrote on last edited by
    #1

    Hi all I have a database named information and every row in this database has a unique id! I want to update the row with the special id(that I have stored that id,for example it is in "ID" variable), but I dont know how should I use the select and update command to do this! plz help me!

    T D S L 4 Replies Last reply
    0
    • S sara setare

      Hi all I have a database named information and every row in this database has a unique id! I want to update the row with the special id(that I have stored that id,for example it is in "ID" variable), but I dont know how should I use the select and update command to do this! plz help me!

      T Offline
      T Offline
      Tim Carmichael
      wrote on last edited by
      #2

      Start by providing the statements you are trying to use; others can only guess at what the table looks like.

      1 Reply Last reply
      0
      • S sara setare

        Hi all I have a database named information and every row in this database has a unique id! I want to update the row with the special id(that I have stored that id,for example it is in "ID" variable), but I dont know how should I use the select and update command to do this! plz help me!

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        The basic update statement is update set = where You probably want something like "where ID = 5" Without more details, this is the best I can do to help.

        S 1 Reply Last reply
        0
        • S sara setare

          Hi all I have a database named information and every row in this database has a unique id! I want to update the row with the special id(that I have stored that id,for example it is in "ID" variable), but I dont know how should I use the select and update command to do this! plz help me!

          S Offline
          S Offline
          Shanalal Kasim
          wrote on last edited by
          #4

          Provide more details like table structure & sample data

          1 Reply Last reply
          0
          • D David Mujica

            The basic update statement is update set = where You probably want something like "where ID = 5" Without more details, this is the best I can do to help.

            S Offline
            S Offline
            sara setare
            wrote on last edited by
            #5

            ok,for example I have an information table with columns(id,fname,lnam) and I want to access the (fname,lnam) by Id,because I want to use them as string; I know that I should the select command Like this: select(id,fname,lname)WHERE id="" but I dont know how to access the fnam,lname with this Id as string!

            1 Reply Last reply
            0
            • S sara setare

              Hi all I have a database named information and every row in this database has a unique id! I want to update the row with the special id(that I have stored that id,for example it is in "ID" variable), but I dont know how should I use the select and update command to do this! plz help me!

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              BEGIN TRANSACTION

              CREATE TABLE Person
              (
              ID INT IDENTITY(1,1) PRIMARY KEY,
              FIRSTNAME VARCHAR(50),
              LASTNAME VARCHAR(50)
              )

              INSERT INTO Person VALUES ('John', 'Doe'), ('Code', 'Project')

              SELECT *
              FROM Person

              UPDATE Person
              SET FIRSTNAME = 'Peter'
              WHERE ID = 1

              SELECT *
              FROM Person

              ROLLBACK

              Execute in SQL-Management Studio. You'll see two tables; one before, and one after the update. You will need a good book that introduces you to some basic SQL-constructions.

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups