sql server autonumber data type

B

Bill Bernat

What is the method I use to place autonumber data type columns in my visio
diagram such that the column is a sql server autonumber data type when
forward-engineered to sql server?

I've set my driver to sql server, but it does not appear. I'm sure there's
a simple answer, can't find it in help though.

Much appreciated!
-billb
 
C

Chang Oh

Change your data type display to Physical type and use Identity type from
SQL Server.

Chang Oh
Visual Studio Enterprise Frameworks and Tools
 
R

Rich R

Bill Bernat said:
What is the method I use to place autonumber data type columns in my visio
diagram such that the column is a sql server autonumber data type when
forward-engineered to sql server?

I've set my driver to sql server, but it does not appear. I'm sure there's
a simple answer, can't find it in help though.

Much appreciated!
-billb

You might want to think of another way of generating keys. With Auto Number
and Increment, you are stuck with a particular implementation. And sometimes
you can't even guess what the next number will be.

The better way to do it this:

CREATE TABLE ID (
Entity varchar(35).
LastID int)

So what you do is do a SELECT this table with an entity type and pull out
the last ID

Update that table "LastId = Last ID + 1 WHERE entity=thisEntity, and move
on. This will work for all SQL implementations but might have some problems
with locking, even in transactions, but I doubt it.

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top