i need a entry of patients in data base where the entry should be
for one year like the id number should generate by one to till the
entries inserted by end of the year in the data base when the next
year starts the id number should start again from 1 how can i do
this????? , can please help me in these tasks
CREATE TABLE new_employees
(
id_num int IDENTITY(1,1), --Note: You first 1 for start value second 1 is the Increment for each.
Pname varchar (20),
gender char(1),
lname varchar(30)
);
INSERT new_employees
(Pname, gender, lname)
VALUES
('Karin', 'F', 'Josephs');
INSERT new_employees
(pname, gender, lname)
VALUES
('Pirkko', 'O', 'Koskitalo');
//id_num will be for first 1, for second 2 and so on.......
//As much I know after 1 year if you want to reset the values of tables then you can use Trigger.But you have to take backup/remove of your old data from the table otherwise if you choose to make Primary key to that identity field then it can cause problem.
Abdul Muqeet
Member
82 Points
428 Posts
ASP page
May 07, 2012 06:10 AM|LINK
i need a entry of patients in data base where the entry should be
for one year like the id number should generate by one to till the
entries inserted by end of the year in the data base when the next
year starts the id number should start again from 1 how can i do
this????? , can please help me in these tasks
Mikesdotnett...
All-Star
154818 Points
19853 Posts
Moderator
MVP
Re: ASP page
May 07, 2012 07:36 AM|LINK
Create a table for patients per year. Use the Identity data type to act as your ID.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
Abdul Muqeet
Member
82 Points
428 Posts
Re: ASP page
May 07, 2012 07:42 AM|LINK
i am new can you show me the steps plz
mishra.bhupe...
Participant
1594 Points
376 Posts
Re: ASP page
May 07, 2012 07:56 AM|LINK
CREATE TABLE new_employees ( id_num int IDENTITY(1,1), --Note: You first 1 for start value second 1 is the Increment for each. Pname varchar (20), gender char(1), lname varchar(30) ); INSERT new_employees (Pname, gender, lname) VALUES ('Karin', 'F', 'Josephs'); INSERT new_employees (pname, gender, lname) VALUES ('Pirkko', 'O', 'Koskitalo'); //id_num will be for first 1, for second 2 and so on.......//As much I know after 1 year if you want to reset the values of tables then you can use Trigger.But you have to take backup/remove of your old data from the table otherwise if you choose to make Primary key to that identity field then it can cause problem.