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
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
Create a IDENTITY (1,1) column of type int in your table.
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
Otherwise I would suggest to use the rownumber, an autonumber field, ...
http://www.mutuallybeneficial.com/index_files/RowNumber_2005.htm
ASKER
asvforce,
no i cannot modify the table
no i cannot modify the table
Do you already have a column to store your serianumber ?
Do you have a column with unique data ?
Do you have a column with unique data ?
ASKER
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.
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.