Here, the initial seed value is 1, and each new value increments by 1.
The identity specification lets you specify both an identity number (an initial value for the column for the
first row inserted into the table) and the value in which to increment when new rows are added. The cool
thing about identity columns is that the database engine takes care of all of the work of automatically
incrementing the identity value and assigning the new value to the new row. Setting this property to
??????Yes??™??™ tells SQL Server to automatically manage the value of this column.
When a primary key is defined, a unique index is created on its columns. The index allows for quick
retrieval of records when the primary key is used in a query.
Define a primary key by clicking the Set Primary Key button (the gold key) on the Table Designer toolbar
when the table is in design mode. Figure 10-2 points out the button on the toolbar.
Figure 10-2
When mapping an object to a relational data object, you need to specify which column is the primary
key. The following code shows the mapping of the AdventureWorks table Sales.
Pages:
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348