Yeah "Update msTableName Set Label = nCount + 1" will do the same for all rows. You need the "where RowId = " clause to discern which row to change. That's why I put it in, also thinking you might as well use that as you go. So you still need to get the RowID value whichever method you use. I wrote the example in my Oulook reply to you and it wasn't tested. Maybe it should be just:
"lnRowID = RowID". Whatever - you're just a wee syntax error away from the soln. with this. Keep at it. You didn't say what the error message was. By the way, I presume you used your actual table name, instead of my example name, in the "lnRowID = MyTable.RowID" line? Also, you try to update the field with "nCount + 1" but nowhere do you increment it; you're using "m"for your for loop counter (not declared in the proc, by the way) Terry -----Original Message----- From: Mayer, Mike @ Vancouver [mailto:[EMAIL PROTECTED] Sent: 12 May 2005 17:31 To: Terry McDonnell Subject: RE: MI-L Updating a Table Column That was close but not quite. I have a loop that I have used below, but I get the same value in each row, I want the loop to a put new value in each row. So row 1 would have the value of "1" row 2 "2" etc. I tried the example from terry, but I got an error on the line lnRowID = MyTable.RowID. My code: Dim nCount, nNumRows as Integer nCount = 1 p = TableInfo(msTableName, TAB_INFO_NROWS) For m = 1 to p Update msTableName Set Label = nCount + 1 Next Any suggestions?? TIA Mike -----Original Message----- From: Terry McDonnell [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 2:05 AM To: [email protected] Subject: RE: MI-L Updating a Table Column Mike Is the following what you mean? ------------------------ DIM lnRowID as SmallInt Fetch first from MyTable Do while not EOT( MyTable) lnRowID = MyTable.RowID Update MyTable set Label = lnRowID where RowID = lnRowID Fetch Next from MyTable Loop -------------------------- On the other hand, you already HAVE numbered rows in the MyTable.RowID system field (as used in the example) HTH Terry -----Original Message----- From: Mayer, Mike @ Vancouver [mailto:[EMAIL PROTECTED] Sent: 11 May 2005 22:46 To: Terry McDonnell Subject: MI-L Updating a Table Column Hello Everyone, I have a small problem where I am trying to update a column in a table. I have created a new column in table called "Label" I want to update this column with numbers 1, 2, 3, each number corresponding to the row it is in. I want to be able to do this for an undetermined amount of rows, meaning, the amount of rows will vary depending on the query. Any suggestions?? Thanks in advance. Mike Mayer (GIS Practicum student....almost finished....) --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 16443 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 16451 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 16458 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 16459
