Click here to Skip to main content
13,055,047 members (60,907 online)
Rate this:
Please Sign up or sign in to vote.
Database design as follows;

Receipt Id text
Bill No text
Receipt Amt Number

In database starting from Receipt id 1 to 1000 records are there in the database.

I want again the receipt id again start with 1.

how can i do? already i have 1000 records in the database. starting from 1 to 1000 records.

how can i do?

Please help me.

Narasiman P
Posted 31-Mar-13 5:32am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If ID is the primary key in your database then you can't, otherwise it is up to you and your application to do the numbering.

Generally it is a better idea not to rely on the primary key, and have your own numbering for this very reason.
Maciej Los 31-Mar-13 15:16pm
Mehdi Gholam 1-Apr-13 1:11am
Thanks Maciej!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Please, read Mehdi Gholam solution.

Try this:
SELECT [Receipt Id], [Bill No], [Receipt Amt Number]
FROM YourTable
WHERE [Receipt Amt Number] = 1

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 31 Mar 2013
Copyright © CodeProject, 1999-2017
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