944,054 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Marked Solved
  • Views: 591
  • MySQL RSS
Oct 7th, 2009
0

Help with generating a unique number

Expand Post »
hello,

I'm trying to create a database in SQL Server management Studio for a project. I have created a tabel named Employee and I have 14 columns. I need to set the firts column (Emp_ID) as Primary Key (accomplished) and then generate a unique number for each Emp_ID that I insert. currently I have no information in my database I'm stuck in finding the procedure to correctly code the SQL statement that will generate a unique Emp_ID when I insert new values or add a new row of information. Can someone please help? I"ve look all over my text and searched the web and cannot find something useful to help.

thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kevlam is offline Offline
9 posts
since Aug 2009
Oct 8th, 2009
0
Re: Help with generating a unique number
sql Syntax (Toggle Plain Text)
  1. CREATE TABLE Employee
  2. (
  3. Emp_Id INT PRIMARY KEY IDENTITY,
  4. LastName VARCHAR(255) NOT NULL,
  5. FirstName VARCHAR(255),
  6. Address VARCHAR(255),
  7. City VARCHAR(255),
  8. postalcode vachar(6),
  9. /* other columns*/
  10. )
not sure about sql server, identity SHOULD be the keyword to make it autoincrement
Last edited by almostbob; Oct 8th, 2009 at 12:35 am.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Oct 8th, 2009
0
Re: Help with generating a unique number
Thank you very much for your help
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kevlam is offline Offline
9 posts
since Aug 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: how to create table relate with other table
Next Thread in MySQL Forum Timeline: Trouble using ORDER BY in a UNION statement





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC