Link to home
Start Free TrialLog in
Avatar of vinodand
vinodand

asked on

creating item serial no

hi all
how do i create srl no for the transaction data available in sql 2000 database. this is required for printing a report in data environment (vb).  like, 1,2,3.. and so on.
this is needed in select query itself.
please help
thank
vinnie
Avatar of Ashish Patel
Ashish Patel
Flag of India image

Create a IDENTITY (1,1) column of type int in your table.
Avatar of Dirk Haest
Does your serial number needs some specific requirements (fe 3 number, 7 digits, ...)
Otherwise I would suggest to use the rownumber, an autonumber field, ...

http://www.mutuallybeneficial.com/index_files/RowNumber_2005.htm
Avatar of vinodand
vinodand

ASKER

asvforce,
no i cannot modify the table
Do you already have a column to store your serianumber ?
Do you have a column with unique data ?
Dhaest:
no and that is the issue.. i have same item code appearing in a orderform, so need to give item serial numbers while printing... how do i do that?  can i generate this number in vb datareport during runtime, otherwise.
I guess you'll have to rethink your design.
Can't you change anything at the database ?

You can also take the rownumber (apparantly only for sql 2005 and higher)

SELECT ROWID=IDENTITY(int,1,1) , EMPID, FNAME, LNAME
INTO EMPLOYEE2 FROM EMPLOYEE ORDER BY EMPID

Source : http://www.databasejournal.com/features/mssql/article.php/3572301
ASKER CERTIFIED SOLUTION
Avatar of Megan Brooks
Megan Brooks
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial