Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: database
How to Generate Serial Number Column in MS Access Query along with other Records.
 
For Eg .
 
AAA 32
BBB 12
CCC 23
 
Output Should be :
 
1 AAA 32
2 BBB 12
3 CCC 23
Posted 22-Mar-10 17:52pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Add an Identity column to your database with the type "Autonumber".
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

It is not possible to write such kind of query on Ms Access Table to have serial number at the time of executing query only. You have to add a column in Ms Access Table as describe in previous answer to get Serial Number in Output.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

It IS actually possible to write SQL that returns a row number. http://www.eggheadcafe.com/software/aspnet/30187160/query-row-number.aspx[^]
 
Of course, it makes more sense to add an identity column.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

It can be achieved using DCOUNT() Function Specifying relative ref. to required col.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,651
1 Sergey Alexandrovich Kryukov 6,400
2 CPallini 5,230
3 George Jonsson 3,574
4 Gihan Liyanage 2,542


Advertise | Privacy | Mobile
Web01 | 2.8.140921.1 | Last Updated 8 Oct 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100