Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqlserverÖбêʶÖÖ×Ó¡¢±êʶºÍ¹«Ê½µÈµÄº¬Òå

sqlserverÖж¨Òå×Ö¶Îʱ£¬ÓбêʶÖÖ×Ó¡¢±êʶºÍ¹«Ê½µÈ£¬ÊÇʲôÒâ˼£¿
Ó¦¸Ã˵µÄÊÇidentity°É

identity?ɶÒâ˼£¿

IDENTITY£¨º¯Êý£©
Ö»ÓÃÔÚ´øÓÐ INTO table ×Ó¾äµÄ SELECT Óï¾äÖУ¬ÒÔ½«±êʶÁвåÈ뵽бíÖС£

¾¡¹ÜÀàËÆ£¬µ«ÊÇ IDENTITY º¯Êý²»ÊÇÓë CREATE TABLE ºÍ ALTER TABLE Ò»ÆðʹÓÃµÄ IDENTITY ÊôÐÔ¡£

Óï·¨
IDENTITY ( data_type [ , seed , increment ] ) AS column_name

²ÎÊý
data_type

±êʶÁеÄÊý¾ÝÀàÐÍ¡£±êʶÁеÄÓÐЧÊý¾ÝÀàÐÍ¿ÉÒÔÊÇÈκÎÕûÊýÊý¾ÝÀàÐÍ·ÖÀàµÄÊý¾ÝÀàÐÍ£¨bit Êý¾ÝÀàÐͳýÍ⣩£¬Ò²¿ÉÒÔÊÇ decimal Êý¾ÝÀàÐÍ¡£

seed

ÒªÖ¸Åɸø±íÖеÚÒ»ÐеÄÖµ¡£¸øÿһ¸öºóÐøÐÐÖ¸ÅÉÏÂÒ»¸ö±êʶֵ£¬¸ÃÖµµÈÓÚÉÏÒ»¸ö IDENTITY Öµ¼ÓÉÏ increment Öµ¡£Èç¹û¼ÈûÓÐÖ¸¶¨ seed£¬Ò²Ã»ÓÐÖ¸¶¨ increment£¬ÄÇôËüÃǶ¼Ä¬ÈÏΪ 1¡£

increment

ÓÃÀ´Ìí¼Óµ½ seed ÖµÒÔ»ñµÃ±íÖÐÁ¬ÐøÐеÄÔöÁ¿¡£

column_name

½«²åÈ뵽бíÖеÄÁеÄÃû³Æ¡£ 



seed 

ÒªÖ¸Åɸø±íÖеÚÒ»ÐеÄÖµ¡£¸øÿһ¸öºóÐøÐÐÖ¸ÅÉÏÂÒ»¸ö±êʶֵ£¬¸ÃÖµµÈÓÚÉÏÒ»¸ö IDENTITY Öµ¼ÓÉÏ increment Öµ¡£Èç¹û¼ÈûÓÐÖ¸¶¨ seed£¬Ò²Ã»ÓÐÖ¸¶¨ increment£¬ÄÇôËüÃǶ¼Ä¬ÈÏΪ 1

seedÖÖ×Ó
±êʶ ×ÔÔöÁÐ
¹«Ê½??ºÍÊýѧµÄ¹«Ê½²î²»¶à

ÒýÓÃ
IDENTITY£¨º¯Êý£©
Ö»ÓÃÔÚ´øÓÐ INTO table ×Ó¾äµÄ SELECT Óï¾äÖУ¬ÒÔ½«±êʶÁвåÈ뵽бíÖС£

¾¡¹ÜÀàËÆ£¬µ«ÊÇ IDENTITY º¯Êý²»ÊÇÓë CREATE TABLE ºÍ ALTER TABLE Ò»ÆðʹÓÃµÄ IDENTITY ÊôÐÔ¡£

Óï·¨
IDENTITY ( data_type [ , seed , increment ] ) AS column_name
<


Ïà¹ØÎÊ´ð£º

Çó½Ì ²é¿´SqlServerÖ´ÐйýµÄ´æ´¢¹ý³Ì״̬

ÔÚSqlServerÖÐÈçºÎ²é¿´ÀúÊ·ÉÏÖ´ÐеĴ洢¹ý³ÌµÄÐÅÏ¢ÄØ£¬È磺´«Èë²ÎÊý£¬Ö´ÐÐʱ¼äµÈµÈ¡£Èç¹û²»Äܲ鿴ÀúÊ·¼Ç¼£¬ÊÇ·ñ¿ÉÒÔ×Ô¼ºÐ´´¥·¢Æ÷Ö®ÀàµÄ£¬È˹¤¿ØÖÆÄØ£¬ÔÚOracleÀïÃæÓж¯Ì¬ÊÓͼ¿ÉÒÔËæʱ²é¿´ÀúÊ·Ö´ÐеÄsqlÓï¾ä£¬SqlSer ......

Çóc#²Ù×÷sqlserverÊý¾Ý¿âÎÊÌâ

ÔÚÊý¾Ý¿âÖÐÓÐÕÅ±í£¬ÓÐid,nameÁ½ÁУ¬id ÊÇÖ÷¼ü,ûÓÐÉèÖÃ×ÔÔöÊôÐÔ,ÔÚ³ÌÐòÖÐÈ¡³öÕâÕűí·ÅÈëdatatable£¬ÔÚÕâ¸ödatatableÖвåÈëÒ»Ìõ¼Ç¼£¬µ±¸üÐÂÊý¾Ý¿âʱÌáʾidÁв»ÄÜΪ¿Õ£¬ÇëÎʸÃÔõô½â¾ö£¿
¸øËüÒ»¸öÖµ£¡£¡Ö÷¼ü²»ÄÜΪ¿Õ ......

Sqlserver Óï¾äת³ÉMySqlÓï¾ä

Ҫת³ÉÒ»ÑùµÄЧ¹û£¬ÓÃpowerdesignerÔõôת£¿ÄÜתÂð£¿
create table publishers (
publisherID int identity,
publisherName varchar (30) NOT NULL,
constraint pk_publishers primary key (publisherID)
)& ......

win7ÉÏ°²×°sqlserver - MS-SQL Server / ÒÉÄÑÎÊÌâ

ÓÐÈËÊÔ¹ýÔÚwin7ÉÏ°²×°sqlserverÂð£¿
Ìý˵sql2000×°²»ÉÏÈ¥£¬²»ÖªµÀÆäËû°æ±¾Ðв»ÐС£

ºÃÏñ²»ÐÐ,²»¼æÈÝ,ÉÏ´ÎÒ²ÓÐÈËÎʹýѽ


ºÇºÇ£¬ÓÐÍøÓÑÓÐÏà¹ØµÄ¾­ÑéÂð£¿
Õâ¸ösqlserverÒª¾¡Á¿×°ÔÚwin7ÉÏ¡£

SQLSERVER 2000Ã ......

sqlserver ÈÕÆÚÀàÐÍת»»

ÔÚÊý¾Ý¿âÖÐÈÕÆÚÈçÏÂÏÔʾ£º2009-2-27 9:40:47
Õâ¸ö²»ÊÇÎÒÏëÒªµÄ£¬ÎÒÐèÒªÔ·ݺÍʱ¼äÓÃÁ½Î»Êý±íʾ£¬ÉÏÃæµÄÓ¦¸Ãת»»Îª;2009-02-27 09:40:47
ÇëÎÊ
1¡¢ÈçºÎ¶ÔÏÖÓÐÈÕÆÚ½øÐÐת»»£¨Êý¾Ý¿âÖÐÒÑ´æÔÚÐí¶àÀàËƵÄÖµ£¬ÎÒÐèÒª½«Æä ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ