Hi guys!

I am developing a web based database for a company for my year work placement for university. As I'm still a student I am still learning so I am not 100% on what i am doing. I was wondering if someone could provide me with some help?...please! :)

The company wants a database that will contain all the equipment that they sell and the customers etc. The customers and equipment already have id numbers. How do I enter the Id numbers that the customers and equipment already have into the database so I dont have to provide them with new ones and still automatically generate numbers for new customers or equipment??

I was going to declare that the field auto generate all the Id numbers before I realised that the customers already have Id numbers. Can I insert my own numbers (the exsiting id's) but still declare the field to auto generate for new customers and equipment?

Any ideas would be appreciated! Thanks!!!

GLT

Recommended Answers

All 2 Replies

SET IDENTITY_INSERT <tablename> ON

Place this statement before your insert statement, it allows you to enter specific id's into an identity seed column. Place this line immediately after your insert statement.

SET IDENTITY_INSERT <tablename> OFF

New id's will continue to be generated for new inserts.

I am assuming there will be a one time insert of existing customers and equipment from some other legacy system? If this is going to be a bolt on to an existing system, then you don't need to generate new id's they are already being generated so you just need a unique index.

yes, ill be getting the ids from an existing system and inserting them once when i create the database for the new system.

Thank you so much!!!
ill give that a try!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.