Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get a rownumber
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Divers
Thread ID:
01525672
Message ID:
01525781
Vues:
27
>>>>Hi All -
>>>>
>>>>I need to update a specific row within a table something like this:
>>>>
>>>>UPDATE mytable SET myfield = 10 WHERE (ROWNUMBER = 4)
>>>>
>>>>but I can't find a good way to identify the row. I've looked at ROW_NUMBER(), IDENTITY(), and RANK(), but none of them seem to fit. Could someone explain how to do this?
>>>>
>>>>Thanks
>>>
>>>You need a key somehow. This isn't VFP. What are the field values that make your 4th row unique? Make them the where clause.
>>
>>Thanks William.
>>My table has a fixed number of rows so I just added another column with rownumber. It seems to work OK. I was just hoping to make it a little simpler with a function like RecordNo().
>>
>>Thanks for the clarification.
>>
>>And now my mantra "Why 'O Why can't MS make SQLServer/NET as easy as VFP?" They should get Calvin and Levy on the team.
>
>In almost every table I create in SQL Server, I create an identity column that I can always use as the primary or at least a unique key. The identity column takes care of itself, so once you create it you don't have to worry about populating it.

Yep, see my response to John.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform