1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Rep Power

    Calling all tsql Gurus

    Hi all I have a guestion that is making my brain hurt.

    I have a table with a list of names and an ID that identifies them with a group. It looks like

    NAME GroupID
    A.Smith 1
    B.Smith 1
    C.Smith 1
    D.Smith 1
    E.Smith 1
    F.Smith 1
    G.Smith 1
    H.Smith 1
    I.Smith 1
    J.Smith 1

    I need to update the table using a stored procedure. I need to take 58% of the records and change their GroupID = 2 and take 42% of the records and change their GroupID to 3. I am totally stumped and was wondering if any one has any Ideas or if this is even possible?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    No es importante
    Rep Power
    You will have to round your round your percentage based on your data population. You will first need to calculate the total number of records then you can use top [n], where n is the calculated number.
    El éxito consiste en una serie de pequeñas victorias día a día

    MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html

IMN logo majestic logo threadwatch logo seochat tools logo