x

IDENTITY() .v. IDENTITY()

(Seeder)

While researching, I found that IDENTITY() can be a property of a table, as well as a function - under what circumstances can it be a function and why is it useful?

more ▼

asked Apr 05, 2010 at 06:51 PM in Default

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.5k 61 65 87

Good question..
Apr 05, 2010 at 06:56 PM CirqueDeSQLeil
(comments are locked)
10|1200 characters needed characters left

1 answer: sort oldest

Identity() can be used as a function when populating a table with integer values to create a table of dummy data for testing. It must be used via the "Select Into" method. After which you should go back and recreate your indexes.

more ▼

answered Apr 05, 2010 at 06:55 PM

CirqueDeSQLeil gravatar image

CirqueDeSQLeil
4.8k 10 11 15

Good answer... :)
Apr 05, 2010 at 07:08 PM Matt Whitfield ♦♦
Thanks Matt. For others, this method is used widely throughout SSC.
Apr 05, 2010 at 07:18 PM CirqueDeSQLeil
+1 to the hell of it:-)
Oct 05, 2010 at 08:04 AM DaniSQL
Thanks Dani
Oct 05, 2010 at 08:58 AM CirqueDeSQLeil
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x34
x27

asked: Apr 05, 2010 at 06:51 PM

Seen: 986 times

Last Updated: Apr 05, 2010 at 06:51 PM