Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005
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.
 
Regards,
Narasiman P
Posted 31-Mar-13 6:32am
Rate this: bad
good
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.
  Permalink  
Comments
Maciej Los at 31-Mar-13 15:16pm
   
+5!
Mehdi Gholam at 1-Apr-13 1:11am
   
Thanks Maciej!
Rate this: bad
good
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
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 31 Mar 2013
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