Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,520 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,802 people online right now. Registration is fast and FREE... Join Now!




Generating complaint number

 
Reply to this topicStart new topic

Generating complaint number

nila
13 Aug, 2008 - 12:13 AM
Post #1

D.I.C Head
**

Joined: 5 Jan, 2008
Posts: 124

Hi,
What i need to do is:If a customer want to make a complaint registration to a bank through phone,a complaint number should be generated automatically for that particular customer in the database. please assist me to do this

Thanks
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: Generating Complaint Number
13 Aug, 2008 - 01:44 AM
Post #2

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 578



Thanked: 16 times
Dream Kudos: 575
My Contributions
You need to define your "complaint number" column as an Identity column. This will generate number automatically, you don't need to pass values to this columns when you insert values to database.

Syntax for Indentity column looks like this:

sql
CREATE TABLE Table_Name 
(ComplaintID INT IDENTITY(1,1) NOT NULL,
Columns2 VARCHAR(100),
Columns3 VARCHAR(100))


IDENTITY(1,1) - Here auto Number will start from 1 and add 1 for each new row.

This post has been edited by dineeshd: 13 Aug, 2008 - 01:45 AM
User is offlineProfile CardPM
+Quote Post

Trogdor
RE: Generating Complaint Number
13 Aug, 2008 - 02:18 AM
Post #3

D.I.C Addict
Group Icon

Joined: 6 Oct, 2006
Posts: 523



Thanked: 3 times
Dream Kudos: 125
My Contributions
the specific syntax depends on the database you are using.
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: Generating Complaint Number
13 Aug, 2008 - 02:44 AM
Post #4

D.I.C Addict
Group Icon

Joined: 30 Jun, 2008
Posts: 578



Thanked: 16 times
Dream Kudos: 575
My Contributions
QUOTE(Trogdor @ 13 Aug, 2008 - 03:48 PM) *

the specific syntax depends on the database you are using.


Yes you are right, code I mentioned is for SQL Server. Since nila didn't specified any database I had provided the SQL Server syntax. Anyway the syntax may not be having a huge difference in different databases.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 09:30PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month