Results 1 to 3 of 3

Thread: SQL Table Update row id

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2016
    Posts
    37

    SQL Table Update row id

    I have table in sql db with 10 lacs of record
    i have added a new column in that as row no by default I set the value as 0
    now i wanted ot update with row no or record no from 1....... to 1000000 whatever will be the no of records
    how shal i do this

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,495

    Re: SQL Table Update row id

    Alter the table and add the column with proper data type
    Update the table set value = X where column is NULL
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: SQL Table Update row id

    If I understand....

    declare @updateValue int
    SET @updateValue = 0
    update Yourtable
    set NewColumn = @UpdateValue ,
    @updateValue = @updateValue + 1
    Please remember next time...elections matter!

Posting Permissions

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



Click Here to Expand Forum to Full Width