Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Identity value in a column

Author  Topic 

aethertan
Starting Member

6 Posts

Posted - 2002-07-08 : 02:03:49


Howdy captain

An identity value is a vlaue assigned to a column in a table to make a row unqiue. This is done asutomatically everytime a new row is added. IS THIS CORRECT!!

ALSO IF IT IS,, can one specify the format of this identity value (EG: 4 characters followed by 2 numbers). Also can you change this format once the identity has been set up for a table after some time. (IE. Say you have set up an identity on table 3 months ago. Now your manager wants you to change the identity from 2 numbers to have 4 letters and then 2 numbers). Can this happpen?

Can someone please help me on this one.

Thanks
Aetheran

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2002-07-08 : 02:15:49
Aetheran,

Read BOL (Books on Line)

DavidM

"SQL-3 is an abomination.."
Go to Top of Page

solart
Posting Yak Master

148 Posts

Posted - 2002-07-08 : 12:17:56
Aetheran,

It appears you are new to SQL Server. May I suggest that it would be beneficial to you to purchase one or two good books on SQL Server (either SQL 7 or SQL 2000, depending on which you are using). Then supplementing your activities by looking up BOL (Books On Line) as you approach each specific topic.

The depth and breadth of SQL is very substantial, but get as good a foundation as you can under you.

www.Amazon.com contains many computer books (new and used) on SQL Server. Reviews are also posted for the books, their table of contents, etc.

solart
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-07-08 : 13:09:31
quote:

An identity value is a vlaue assigned to a column in a table to make a row unqiue. This is done asutomatically everytime a new row is added. IS THIS CORRECT!!

Incorrect. IDENTITY is a property of a column of type tinyint, smallint, int, decimal(p,0) or numeric(p,0). On insert of a new row, SQL Server will populate the column with a unique, incremental value.

quote:

ALSO IF IT IS,, can one specify the format of this identity value (EG: 4 characters followed by 2 numbers). Also can you change this format once the identity has been set up for a table after some time. (IE. Say you have set up an identity on table 3 months ago. Now your manager wants you to change the identity from 2 numbers to have 4 letters and then 2 numbers). Can this happpen?

Yes, this can be done, but has nothing to do with IDENTITY. You will need to create these values based on your ruleset in either a trigger, functions or prior to you insert statement.

<O>
Go to Top of Page
   

- Advertisement -